Index: pkg/kernel/testcases/interpreter/constructor_test.dart |
diff --git a/pkg/kernel/testcases/interpreter/constructor_test.dart b/pkg/kernel/testcases/interpreter/constructor_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5e3d19b9c911a63bddf2c64dcbc1b3b9ea25e5fb |
--- /dev/null |
+++ b/pkg/kernel/testcases/interpreter/constructor_test.dart |
@@ -0,0 +1,36 @@ |
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+library constructor_test; |
+ |
+void main() { |
+ var a = new A(); |
+ print(a.foo); |
+ print('******************'); |
+ |
+ var b = new B(); |
+ print(b.foo); |
+ print(b.bar); |
+} |
+ |
+class A { |
+ String foo = fieldInitializer(0, 'A.foo'); |
+ |
+ A() : foo = fieldInitializer(1, 'A.foo') { |
+ foo = fieldInitializer(2, 'A.foo'); |
+ } |
+} |
+ |
+class B extends A { |
+ String bar = fieldInitializer(0, 'B.bar'); |
+ |
+ B() : bar = fieldInitializer(1, 'B.bar') { |
+ bar = fieldInitializer(2, 'B.bar'); |
+ } |
+} |
+ |
+String fieldInitializer(int f, String s) { |
+ print('$s: $f'); |
+ return '$s: $f'; |
+} |