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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 class A { | 7 class A { |
8 final x; | 8 final x; |
9 const A(this.x); | 9 const A(this.x); |
10 const A.redirect(x) : this(x + 1); | 10 const A.redirect(x) : this(x + 1); |
11 const A.optional([this.x = 5]); | 11 const A.optional([this.x = 5]); |
12 } | 12 } |
13 | 13 |
14 class B extends A { | 14 class B extends A { |
15 const B(x, this.y) : super(x); | 15 const B(x, this.y) : super(x); |
16 const B.redirect(x, y) : this(x + 22, y + 22); | 16 const B.redirect(x, y) : this(x + 22, y + 22); |
17 const B.redirect2(x, y) : this.redirect3(x + 122, y + 122); | 17 const B.redirect2(x, y) : this.redirect3(x + 122, y + 122); |
18 const B.redirect3(x, y) : this.y = y, super.redirect(x); | 18 const B.redirect3(x, y) |
| 19 : this.y = y, |
| 20 super.redirect(x); |
19 const B.optional(x, [this.y]) : super(x); | 21 const B.optional(x, [this.y]) : super(x); |
20 const B.optional2([x, this.y]) : super(x); | 22 const B.optional2([x, this.y]) : super(x); |
21 final y; | 23 final y; |
22 } | 24 } |
23 | 25 |
24 class C extends B { | 26 class C extends B { |
25 const C(x, y, this.z) : super(x, y); | 27 const C(x, y, this.z) : super(x, y); |
26 const C.redirect(x, y, z) : this(x + 33, y + 33, z + 33); | 28 const C.redirect(x, y, z) : this(x + 33, y + 33, z + 33); |
27 const C.redirect2(x, y, z) : this.redirect3(x + 333, y + 333, z + 333); | 29 const C.redirect2(x, y, z) : this.redirect3(x + 333, y + 333, z + 333); |
28 const C.redirect3(x, y, z) : this.z = z, super.redirect2(x, y); | 30 const C.redirect3(x, y, z) |
| 31 : this.z = z, |
| 32 super.redirect2(x, y); |
29 const C.optional(x, [y, this.z]) : super(x, y); | 33 const C.optional(x, [y, this.z]) : super(x, y); |
30 const C.optional2([x, y, z]): this.z = z, super(x, y); | 34 const C.optional2([x, y, z]) |
| 35 : this.z = z, |
| 36 super(x, y); |
31 const C.optional3([this.z]) : super.optional2(); | 37 const C.optional3([this.z]) : super.optional2(); |
32 final z; | 38 final z; |
33 } | 39 } |
34 | 40 |
35 const a1 = const A(499); | 41 const a1 = const A(499); |
36 const a2 = const A.redirect(10499); | 42 const a2 = const A.redirect(10499); |
37 const a3 = const A.optional(); | 43 const a3 = const A.optional(); |
38 const a1b = const A.redirect(498); | 44 const a1b = const A.redirect(498); |
39 const a3b = const A(5); | 45 const a3b = const A(5); |
40 | 46 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 Expect.equals(null, c6.y); | 104 Expect.equals(null, c6.y); |
99 Expect.equals(null, c6.z); | 105 Expect.equals(null, c6.z); |
100 Expect.equals(null, c7.x); | 106 Expect.equals(null, c7.x); |
101 Expect.equals(null, c7.y); | 107 Expect.equals(null, c7.y); |
102 Expect.equals(null, c7.z); | 108 Expect.equals(null, c7.z); |
103 Expect.equals(null, c8.x); | 109 Expect.equals(null, c8.x); |
104 Expect.equals(null, c8.y); | 110 Expect.equals(null, c8.y); |
105 Expect.equals(9911, c8.z); | 111 Expect.equals(9911, c8.z); |
106 Expect.identical(c3, c3b); | 112 Expect.identical(c3, c3b); |
107 } | 113 } |
OLD | NEW |