| 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 class ParameterInitializerTest { | 5 class ParameterInitializerTest { |
| 6 | 6 |
| 7 static testMain() { | 7 static testMain() { |
| 8 var obj = new Foo.untyped(1); | 8 var obj = new Foo.untyped(1); |
| 9 Expect.equals(1, obj.x); | 9 Expect.equals(1, obj.x); |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class SubFoo extends Foo { | 49 class SubFoo extends Foo { |
| 50 SubFoo(num y) : super(y), x_ = 0 { | 50 SubFoo(num y) : super(y), x_ = 0 { |
| 51 // Subfoo.setter of x has been invoked in the Foo constructor. | 51 // Subfoo.setter of x has been invoked in the Foo constructor. |
| 52 Expect.equals(x, 1); | 52 Expect.equals(x, 1); |
| 53 Expect.equals(x_, 1); | 53 Expect.equals(x_, 1); |
| 54 | 54 |
| 55 // The super.x will resolved to the field in Foo. | 55 // The super.x will resolved to the field in Foo. |
| 56 Expect.equals(super.x, y); | 56 Expect.equals(super.x, y); |
| 57 } | 57 } |
| 58 | 58 |
| 59 get x() { | 59 get x { |
| 60 return x_; | 60 return x_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 set x(num val) { | 63 set x(num val) { |
| 64 x_ = val; | 64 x_ = val; |
| 65 } | 65 } |
| 66 | 66 |
| 67 num x_; | 67 num x_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 class SubSubFoo extends SubFoo { | 70 class SubSubFoo extends SubFoo { |
| 71 SubSubFoo(num y) : super(y) { | 71 SubSubFoo(num y) : super(y) { |
| 72 // Subfoo.setter of x has been invoked in the Foo constructor. | 72 // Subfoo.setter of x has been invoked in the Foo constructor. |
| 73 Expect.equals(x, 1); | 73 Expect.equals(x, 1); |
| 74 Expect.equals(x_, 1); | 74 Expect.equals(x_, 1); |
| 75 | 75 |
| 76 // There is no way to get to the field in Foo. | 76 // There is no way to get to the field in Foo. |
| 77 Expect.equals(super.x, 1); | 77 Expect.equals(super.x, 1); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 main() { | 81 main() { |
| 82 ParameterInitializerTest.testMain(); | 82 ParameterInitializerTest.testMain(); |
| 83 } | 83 } |
| OLD | NEW |