| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import "package:expect/expect.dart"; | |
| 6 | |
| 7 main() { | |
| 8 new Param.test1(false); | |
| 9 new Param.test1(true, 42); | |
| 10 | |
| 11 new Param.test2(false); | |
| 12 new Param.test2(true, 42); | |
| 13 | |
| 14 new Param.test3(false); | |
| 15 new Param.test3(true, 42); | |
| 16 | |
| 17 new Param.test4(); | |
| 18 new Param.test5(); | |
| 19 | |
| 20 new Param.test6(false); | |
| 21 new Param.test6(true, 42); | |
| 22 | |
| 23 new Param.test7(); | |
| 24 new Param.test8(); | |
| 25 } | |
| 26 | |
| 27 class Super { | |
| 28 var superField; | |
| 29 var otherSuperField; | |
| 30 | |
| 31 Super(); | |
| 32 Super.withParameters(passed, op, value) { | |
| 33 Expect.equals(passed, op); | |
| 34 Expect.equals(passed ? 42 : 0, value); | |
| 35 } | |
| 36 | |
| 37 Super.withOptional(passed, [int a]) : superField = ?a { | |
| 38 Expect.equals(passed, ?a); | |
| 39 Expect.equals(passed, superField); | |
| 40 } | |
| 41 | |
| 42 Super.withUpdate(passed, [int a = 0]) | |
| 43 : superField = ?a, otherSuperField = a++ { | |
| 44 Expect.equals(passed, ?a); | |
| 45 Expect.equals(passed, superField); | |
| 46 Expect.equals(passed ? 43 : 1, a); | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 class Param extends Super { | |
| 51 var field; | |
| 52 var otherField; | |
| 53 | |
| 54 Param.test1(a_check, [int a]) { | |
| 55 Expect.equals(a_check, ?a); | |
| 56 } | |
| 57 | |
| 58 Param.test2(passed, [int a]) : field = ?a { | |
| 59 Expect.equals(passed, ?a); | |
| 60 Expect.equals(passed, field); | |
| 61 } | |
| 62 | |
| 63 Param.test3(passed, [int a = 0]) : super.withParameters(passed, ?a, a) { | |
| 64 Expect.equals(passed, ?a); | |
| 65 } | |
| 66 | |
| 67 Param.test4() : super.withOptional(true, 42); | |
| 68 Param.test5() : super.withOptional(false); | |
| 69 | |
| 70 Param.test6(passed, [int a = 0]) : field = ?a, otherField = a++ { | |
| 71 Expect.equals(passed, ?a); | |
| 72 Expect.equals(passed, field); | |
| 73 Expect.equals(passed ? 43 : 1, a); | |
| 74 } | |
| 75 | |
| 76 Param.test7() : super.withUpdate(true, 42); | |
| 77 Param.test8() : super.withUpdate(false); | |
| 78 } | |
| OLD | NEW |