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 a1n = const A.n(99, 100); | 35 const a1n = const A.n(99, 100); |
23 const a2 = const A.named(z: 99, t: 100); | 36 const a2 = const A.named(z: 99, t: 100); |
24 const a3 = const A.named2(t: 1, z: 2, y: 3, x: 4); | 37 const a3 = const A.named2(t: 1, z: 2, y: 3, x: 4); |
25 const a4 = const A(); | 38 const a4 = const A(); |
26 const a5 = const A(99, 100); | 39 const a5 = const A(99, 100); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Expect.equals("A null null null null", a8.toString()); | 80 Expect.equals("A null null null null", a8.toString()); |
68 | 81 |
69 Expect.isTrue(identical(a3, a9)); | 82 Expect.isTrue(identical(a3, a9)); |
70 | 83 |
71 Expect.equals(4, a10.x); | 84 Expect.equals(4, a10.x); |
72 Expect.equals(3, a10.y); | 85 Expect.equals(3, a10.y); |
73 Expect.equals(2, a10.z); | 86 Expect.equals(2, a10.z); |
74 Expect.equals(1, a10.t); | 87 Expect.equals(1, a10.t); |
75 Expect.equals("A 4 3 2 1", a10.toString()); | 88 Expect.equals("A 4 3 2 1", a10.toString()); |
76 } | 89 } |
OLD | NEW |