| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // Dart test program for testing setting/getting of instance fields. |
| 5 |
| 6 class A { |
| 7 final x = 4; |
| 8 const A(this.x); |
| 9 const A.named([this.x]); |
| 10 const A.named2([this.x = 2]); |
| 11 const A.named3(); |
| 12 } |
| 13 |
| 14 class B extends A { |
| 15 const B(x) : super(x + 10); |
| 16 const B.named_() : super.named(); |
| 17 const B.named(x) : super.named(x + 10); |
| 18 const B.named2_() : super.named2(); |
| 19 const B.named2(x) : super.named2(x + 10); |
| 20 const B.named3() : super.named3(); |
| 21 } |
| 22 |
| 23 final b1 = const B(0); |
| 24 final b2 = const B.named_(); |
| 25 final b3 = const B.named(1); |
| 26 final b4 = const B.named2_(); |
| 27 final b5 = const B.named2(3); |
| 28 final b6 = const B.named3(); |
| 29 |
| 30 main() { |
| 31 Expect.equals(10, b1.x); |
| 32 Expect.equals(null, b2.x); |
| 33 Expect.equals(11, b3.x); |
| 34 Expect.equals(2, b4.x); |
| 35 Expect.equals(13, b5.x); |
| 36 Expect.equals(4, b6.x); |
| 37 } |
| OLD | NEW |