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

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

Issue 2881053002: Add support for super constructor invocation (Closed)
Patch Set: 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 object_super_test;
6
7 /// Simple program creating an object with super constructor invocation.
8 void main() {
9 var a = new A.withArgs(0);
10 print(a.foo);
11
12 var b1 = new B.withSuper();
13 print(b1.foo);
14 print(b1.bar);
15
16 var b2 = new B();
17 print(b2.foo);
18 print(b2.bar);
19 }
20
21 class A {
22 String foo;
23
24 A() : this.withArgs(0);
25 A.withArgs(int i) : foo = fieldInitializer(i, 'A.foo');
26 }
27
28 class B extends A {
29 String bar;
30
31 B();
32 B.withSuper()
33 : bar = fieldInitializer(0, 'B.bar'),
34 super.withArgs(1);
35 }
36
37 String fieldInitializer(int f, String s) {
38 print('$s: $f');
39 return '$s: $f';
40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698