| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 oneOptionalArgument(a, [b]) { | 5 oneOptionalArgument(a, {b}) { |
| 6 Expect.equals(1, a); | 6 Expect.equals(1, a); |
| 7 Expect.equals(2, b); | 7 Expect.equals(2, b); |
| 8 } | 8 } |
| 9 | 9 |
| 10 twoOptionalArguments([a, b]) { | 10 twoOptionalArguments({a, b}) { |
| 11 Expect.equals(1, a); | 11 Expect.equals(1, a); |
| 12 Expect.equals(2, b); | 12 Expect.equals(2, b); |
| 13 } | 13 } |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 twoOptionalArguments(a: 1, b: 2); | 16 twoOptionalArguments(a: 1, b: 2); |
| 17 twoOptionalArguments(b: 2, a: 1); | 17 twoOptionalArguments(b: 2, a: 1); |
| 18 twoOptionalArguments(1, b: 2); | |
| 19 twoOptionalArguments(1, 2); | |
| 20 | 18 |
| 21 oneOptionalArgument(1, 2); | |
| 22 oneOptionalArgument(1, b: 2); | 19 oneOptionalArgument(1, b: 2); |
| 23 | 20 |
| 24 new A.twoOptionalArguments(a: 1, b: 2); | 21 new A.twoOptionalArguments(a: 1, b: 2); |
| 25 new A.twoOptionalArguments(b: 2, a: 1); | 22 new A.twoOptionalArguments(b: 2, a: 1); |
| 26 new A.twoOptionalArguments(1, b: 2); | |
| 27 new A.twoOptionalArguments(1, 2); | |
| 28 | 23 |
| 29 new A.oneOptionalArgument(1, 2); | |
| 30 new A.oneOptionalArgument(1, b: 2); | 24 new A.oneOptionalArgument(1, b: 2); |
| 31 | 25 |
| 32 /* TODO(ngeoffray): Enable once we support super constructor call. | |
| 33 new B.one(); | 26 new B.one(); |
| 34 new B.two(); | 27 new B.two(); |
| 35 new B.three(); | 28 new B.three(); |
| 36 new B.four(); | |
| 37 new B.five(); | |
| 38 new B.six(); | |
| 39 */ | |
| 40 | 29 |
| 41 new B().one(); | 30 new B().B_one(); |
| 42 new B().two(); | 31 new B().B_two(); |
| 43 new B().three(); | 32 new B().B_three(); |
| 44 new B().four(); | |
| 45 new B().five(); | |
| 46 new B().six(); | |
| 47 } | 33 } |
| 48 | 34 |
| 49 class A { | 35 class A { |
| 50 A.oneOptionalArgument(a, [b]) { | 36 A.oneOptionalArgument(a, {b}) { |
| 51 Expect.equals(1, a); | 37 Expect.equals(1, a); |
| 52 Expect.equals(2, b); | 38 Expect.equals(2, b); |
| 53 } | 39 } |
| 54 | 40 |
| 55 A.twoOptionalArguments([a, b]) { | 41 A.twoOptionalArguments({a, b}) { |
| 56 Expect.equals(1, a); | 42 Expect.equals(1, a); |
| 57 Expect.equals(2, b); | 43 Expect.equals(2, b); |
| 58 } | 44 } |
| 59 | 45 |
| 60 A(); | 46 A(); |
| 61 | 47 |
| 62 oneOptionalArgument(a, [b]) { | 48 // A named constructor now conflicts with a method of the same name. |
| 49 oneOptArg(a, {b}) { |
| 63 Expect.equals(1, a); | 50 Expect.equals(1, a); |
| 64 Expect.equals(2, b); | 51 Expect.equals(2, b); |
| 65 } | 52 } |
| 66 | 53 |
| 67 twoOptionalArguments([a, b]) { | 54 twoOptArgs({a, b}) { |
| 68 Expect.equals(1, a); | 55 Expect.equals(1, a); |
| 69 Expect.equals(2, b); | 56 Expect.equals(2, b); |
| 70 } | 57 } |
| 71 } | 58 } |
| 72 | 59 |
| 73 class B extends A { | 60 class B extends A { |
| 74 B.one() : super.twoOptionalArguments(a: 1, b: 2); | 61 B.one() : super.twoOptionalArguments(a: 1, b: 2); |
| 75 B.two() : super.twoOptionalArguments(b: 2, a: 1); | 62 B.two() : super.twoOptionalArguments(b: 2, a: 1); |
| 76 B.three() : super.twoOptionalArguments(1, b: 2); | 63 B.three() : super.oneOptionalArgument(1, b: 2); |
| 77 B.four() : super.twoOptionalArguments(1, 2); | |
| 78 B.five() : super.oneOptionalArgument(1, 2); | |
| 79 B.six() : super.oneOptionalArgument(1, b: 2); | |
| 80 | 64 |
| 81 B(); | 65 B(); |
| 82 one() { super.twoOptionalArguments(a: 1, b: 2); } | 66 B_one() { super.twoOptArgs(a: 1, b: 2); } |
| 83 two() { super.twoOptionalArguments(b: 2, a: 1); } | 67 B_two() { super.twoOptArgs(b: 2, a: 1); } |
| 84 three() { super.twoOptionalArguments(1, b: 2); } | 68 B_three() { super.oneOptArg(1, b: 2); } |
| 85 four() { super.twoOptionalArguments(1, 2); } | |
| 86 five() { super.oneOptionalArgument(1, 2); } | |
| 87 six() { super.oneOptionalArgument(1, b: 2); } | |
| 88 } | 69 } |
| OLD | NEW |