| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Verify that a named mixin constructor forwards to the corresponding named |
| 6 // base class constructor. |
| 7 |
| 5 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 6 | 9 |
| 7 abstract class Mixin1 { | 10 abstract class Mixin1 { |
| 8 var mixin1Field = 1; | 11 var mixin1Field = 1; |
| 9 } | 12 } |
| 10 | 13 |
| 11 abstract class Mixin2 { | 14 abstract class Mixin2 { |
| 12 var mixin2Field = 2; | 15 var mixin2Field = 2; |
| 13 } | 16 } |
| 14 | 17 |
| 15 class A { | 18 class A { |
| 16 var superField; | 19 var superField; |
| 17 A(foo) : superField = foo; | 20 A(foo) : superField = 0; |
| 21 A.c1(foo) : superField = foo; |
| 22 A.c2(foo) : superField = 0; |
| 18 } | 23 } |
| 19 | 24 |
| 20 class B extends A with Mixin1, Mixin2 { | 25 class B extends A with Mixin1, Mixin2 { |
| 21 var field = 4; | 26 var field = 4; |
| 22 B(unused) : super(3); | 27 B(unused) : super.c1(3); |
| 23 } | 28 } |
| 24 | 29 |
| 25 main() { | 30 main() { |
| 26 var b = new B(null); | 31 var b = new B(null); |
| 27 Expect.equals(1, b.mixin1Field); | 32 Expect.equals(1, b.mixin1Field); |
| 28 Expect.equals(2, b.mixin2Field); | 33 Expect.equals(2, b.mixin2Field); |
| 29 Expect.equals(3, b.superField); | 34 Expect.equals(3, b.superField); |
| 30 Expect.equals(4, b.field); | 35 Expect.equals(4, b.field); |
| 31 } | 36 } |
| OLD | NEW |