Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(846)

Side by Side Diff: pkg/kernel/testcases/interpreter/constructor_test.dart

Issue 2880343002: Add support for execution of constructor body (Closed)
Patch Set: Refactor Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, 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
5 library constructor_test;
6
7 void main() {
8 var a = new A();
9 print(a.foo);
10 print('******************');
11
12 var b = new B();
13 print(b.foo);
14 print(b.bar);
15 }
16
17 class A {
18 String foo = fieldInitializer(0, 'A.foo');
19
20 A() : foo = fieldInitializer(1, 'A.foo') {
21 foo = fieldInitializer(2, 'A.foo');
22 }
23 }
24
25 class B extends A {
26 String bar = fieldInitializer(0, 'B.bar');
27
28 B() : bar = fieldInitializer(1, 'B.bar') {
29 bar = fieldInitializer(2, 'B.bar');
30 }
31 }
32
33 String fieldInitializer(int f, String s) {
34 print('$s: $f');
35 return '$s: $f';
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698