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 final y; | 9 final y; |
10 final z; | 10 final z; |
11 final t; | 11 final t; |
12 | 12 |
13 const A([this.z = 99, tt = 100]) : y = 499, t = tt, x = 3; | 13 const A([this.z = 99, tt = 100]) |
14 const A.n({this.z: 99, tt: 100}) : y = 499, t = tt, x = 3; | 14 : y = 499, |
15 const A.named({z, this.t}) : y = 400 + z, this.z = z, x = 3; | 15 t = tt, |
16 const A.named2({t, z, y, x}) : x = t, y = z, z = y, t = x; | 16 x = 3; |
| 17 const A.n({this.z: 99, tt: 100}) |
| 18 : y = 499, |
| 19 t = tt, |
| 20 x = 3; |
| 21 const A.named({z, this.t}) |
| 22 : y = 400 + z, |
| 23 this.z = z, |
| 24 x = 3; |
| 25 const A.named2({t, z, y, x}) |
| 26 : x = t, |
| 27 y = z, |
| 28 z = y, |
| 29 t = x; |
17 | 30 |
18 toString() => "A $x $y $z $t"; | 31 toString() => "A $x $y $z $t"; |
19 } | 32 } |
20 | 33 |
21 const a1 = const A(99, 100); | 34 const a1 = const A(99, 100); |
22 const a2 = const A.named(z: 99, t: 100); | 35 const a2 = const A.named(z: 99, t: 100); |
23 const a3 = const A.named2(t: 1, z: 2, y: 3, x: 4); | 36 const a3 = const A.named2(t: 1, z: 2, y: 3, x: 4); |
24 const a4 = const A(); | 37 const a4 = const A(); |
25 const a5 = const A(99, 100); | 38 const a5 = const A(99, 100); |
26 const a5n = const A.n(tt: 100, z: 99); | 39 const a5n = const A.n(tt: 100, z: 99); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 Expect.equals("A null null null null", a8.toString()); | 79 Expect.equals("A null null null null", a8.toString()); |
67 | 80 |
68 Expect.isTrue(identical(a3, a9)); | 81 Expect.isTrue(identical(a3, a9)); |
69 | 82 |
70 Expect.equals(4, a10.x); | 83 Expect.equals(4, a10.x); |
71 Expect.equals(3, a10.y); | 84 Expect.equals(3, a10.y); |
72 Expect.equals(2, a10.z); | 85 Expect.equals(2, a10.z); |
73 Expect.equals(1, a10.t); | 86 Expect.equals(1, a10.t); |
74 Expect.equals("A 4 3 2 1", a10.toString()); | 87 Expect.equals("A 4 3 2 1", a10.toString()); |
75 } | 88 } |
OLD | NEW |