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 int i = 0; | 7 int i = 0; |
8 | 8 |
9 // Tests super calls and constructors. | 9 // Tests super calls and constructors. |
10 main() { | 10 main() { |
(...skipping 10 matching lines...) Expand all Loading... |
21 Expect.equals(1, sub.y); | 21 Expect.equals(1, sub.y); |
22 Expect.equals(2, sub.v); | 22 Expect.equals(2, sub.v); |
23 Expect.equals(3, sub.w); | 23 Expect.equals(3, sub.w); |
24 Expect.equals(4, sub.z); | 24 Expect.equals(4, sub.z); |
25 Expect.equals(5, sub.u); | 25 Expect.equals(5, sub.u); |
26 } | 26 } |
27 | 27 |
28 class Sup { | 28 class Sup { |
29 var x, y, z; | 29 var x, y, z; |
30 | 30 |
31 Sup(a, b) : this.x = a, this.y = b { | 31 Sup(a, b) |
| 32 : this.x = a, |
| 33 this.y = b { |
32 z = a + b; | 34 z = a + b; |
33 } | 35 } |
34 | 36 |
35 Sup.stat() : this.x = i++, this.y = i++ { | 37 Sup.stat() |
| 38 : this.x = i++, |
| 39 this.y = i++ { |
36 z = i++; | 40 z = i++; |
37 } | 41 } |
38 } | 42 } |
39 | 43 |
40 class Sub extends Sup { | 44 class Sub extends Sup { |
41 var u, v, w; | 45 var u, v, w; |
42 | 46 |
43 Sub(a, b) : super(a, b), this.v = a, this.w = b { | 47 Sub(a, b) |
| 48 : super(a, b), |
| 49 this.v = a, |
| 50 this.w = b { |
44 u = a + b; | 51 u = a + b; |
45 } | 52 } |
46 | 53 |
47 Sub.stat() : super.stat(), this.v = i++, this.w = i++ { | 54 Sub.stat() |
| 55 : super.stat(), |
| 56 this.v = i++, |
| 57 this.w = i++ { |
48 u = i++; | 58 u = i++; |
49 } | 59 } |
50 } | 60 } |
OLD | NEW |