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 oneOptionalArgument(a, [b]) { | |
6 Expect.equals(1, a); | |
7 Expect.equals(2, b); | |
8 } | |
9 | |
10 twoOptionalArguments([a, b]) { | |
11 Expect.equals(1, a); | |
12 Expect.equals(2, b); | |
13 } | |
14 | |
15 main() { | |
16 twoOptionalArguments(a: 1, b: 2); | |
17 twoOptionalArguments(b: 2, a: 1); | |
18 twoOptionalArguments(1, b: 2); | |
19 twoOptionalArguments(1, 2); | |
20 | |
21 oneOptionalArgument(1, 2); | |
22 oneOptionalArgument(1, b: 2); | |
23 | |
24 new A.twoOptionalArguments(a: 1, b: 2); | |
25 new A.twoOptionalArguments(b: 2, a: 1); | |
26 new A.twoOptionalArguments(1, b: 2); | |
27 new A.twoOptionalArguments(1, 2); | |
28 | |
29 new A.oneOptionalArgument(1, 2); | |
30 new A.oneOptionalArgument(1, b: 2); | |
31 | |
32 /* TODO(ngeoffray): Enable once we support super constructor call. | |
33 new B.one(); | |
34 new B.two(); | |
35 new B.three(); | |
36 new B.four(); | |
37 new B.five(); | |
38 new B.six(); | |
39 */ | |
40 | |
41 new B().one(); | |
42 new B().two(); | |
43 new B().three(); | |
44 new B().four(); | |
45 new B().five(); | |
46 new B().six(); | |
47 } | |
48 | |
49 class A { | |
50 A.oneOptionalArgument(a, [b]) { | |
51 Expect.equals(1, a); | |
52 Expect.equals(2, b); | |
53 } | |
54 | |
55 A.twoOptionalArguments([a, b]) { | |
56 Expect.equals(1, a); | |
57 Expect.equals(2, b); | |
58 } | |
59 | |
60 A(); | |
61 | |
62 oneOptionalArgument(a, [b]) { | |
63 Expect.equals(1, a); | |
64 Expect.equals(2, b); | |
65 } | |
66 | |
67 twoOptionalArguments([a, b]) { | |
68 Expect.equals(1, a); | |
69 Expect.equals(2, b); | |
70 } | |
71 } | |
72 | |
73 class B extends A { | |
74 B.one() : super.twoOptionalArguments(a: 1, b: 2); | |
75 B.two() : super.twoOptionalArguments(b: 2, a: 1); | |
76 B.three() : super.twoOptionalArguments(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 | |
81 B(); | |
82 one() { super.twoOptionalArguments(a: 1, b: 2); } | |
83 two() { super.twoOptionalArguments(b: 2, a: 1); } | |
84 three() { super.twoOptionalArguments(1, b: 2); } | |
85 four() { super.twoOptionalArguments(1, 2); } | |
86 five() { super.oneOptionalArgument(1, 2); } | |
87 six() { super.oneOptionalArgument(1, b: 2); } | |
88 } | |
OLD | NEW |