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 | |
ahe
2012/11/06 15:14:22
What does this test do?
| |
5 class A { | |
6 var f; | |
7 var g; | |
8 A(a) : f = (() => 42 + a), g = (() => ++a) { | |
9 a = 4; | |
10 } | |
11 } | |
12 | |
13 class B extends A { | |
14 B() : super(42); | |
15 } | |
16 | |
17 class C extends A { | |
18 var h; | |
19 C(a) : super(42), h = (() => ++a); | |
20 } | |
21 | |
22 main() { | |
23 var a = new A(1); | |
24 Expect.equals(46, a.f()); | |
25 Expect.equals(5, a.g()); | |
26 Expect.equals(47, a.f()); | |
27 | |
28 a = new B(); | |
29 Expect.equals(46, a.f()); | |
30 Expect.equals(5, a.g()); | |
31 Expect.equals(47, a.f()); | |
32 | |
33 a = new C(0); | |
34 Expect.equals(46, a.f()); | |
35 Expect.equals(5, a.g()); | |
36 Expect.equals(47, a.f()); | |
37 Expect.equals(1, a.h()); | |
38 Expect.equals(2, a.h()); | |
39 Expect.equals(47, a.f()); | |
40 Expect.equals(6, a.g()); | |
41 Expect.equals(48, a.f()); | |
42 } | |
OLD | NEW |