OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Test for iterators on for [SubclassNode]. | 5 // Test for iterators on for [SubclassNode]. |
6 | 6 |
7 library subtypeset_test; | 7 library subtypeset_test; |
8 | 8 |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
11 import 'type_test_helper.dart'; | 11 import 'type_test_helper.dart'; |
12 import 'package:compiler/src/elements/elements.dart' show ClassElement; | 12 import 'package:compiler/src/elements/elements.dart' show ClassElement; |
13 import 'package:compiler/src/universe/class_set.dart'; | 13 import 'package:compiler/src/universe/class_set.dart'; |
14 import 'package:compiler/src/world.dart'; | 14 import 'package:compiler/src/world.dart'; |
15 | 15 |
16 void main() { | 16 void main() { |
17 asyncTest(() => TypeEnvironment | 17 asyncTest(() => TypeEnvironment.create(r""" |
18 .create( | |
19 r""" | |
20 /// A | 18 /// A |
21 /// / \ | 19 /// / \ |
22 /// B C | 20 /// B C |
23 /// / /|\ | 21 /// / /|\ |
24 /// D E F G | 22 /// D E F G |
25 /// | 23 /// |
26 class A { | 24 class A { |
27 call(H h, I i) {} // Make `H` and `I` part of the world. | 25 call(H h, I i) {} // Make `H` and `I` part of the world. |
28 } | 26 } |
29 class B extends A implements C {} | 27 class B extends A implements C {} |
30 class C extends A {} | 28 class C extends A {} |
31 class D extends B implements A {} | 29 class D extends B implements A {} |
32 class E extends C implements B {} | 30 class E extends C implements B {} |
33 class F extends C {} | 31 class F extends C {} |
34 class G extends C {} | 32 class G extends C {} |
35 class H implements C {} | 33 class H implements C {} |
36 class I implements H {} | 34 class I implements H {} |
37 """, | 35 """, mainSource: r""" |
38 mainSource: r""" | |
39 main() { | 36 main() { |
40 new A(); | 37 new A(); |
41 new C(); | 38 new C(); |
42 new D(); | 39 new D(); |
43 new E(); | 40 new E(); |
44 new F(); | 41 new F(); |
45 new G(); | 42 new G(); |
46 } | 43 } |
47 """, | 44 """, useMockCompiler: false).then((env) { |
48 useMockCompiler: false) | |
49 .then((env) { | |
50 ClosedWorld world = env.closedWorld; | 45 ClosedWorld world = env.closedWorld; |
51 | 46 |
52 ClassElement A = env.getElement("A"); | 47 ClassElement A = env.getElement("A"); |
53 ClassElement B = env.getElement("B"); | 48 ClassElement B = env.getElement("B"); |
54 ClassElement C = env.getElement("C"); | 49 ClassElement C = env.getElement("C"); |
55 ClassElement D = env.getElement("D"); | 50 ClassElement D = env.getElement("D"); |
56 ClassElement E = env.getElement("E"); | 51 ClassElement E = env.getElement("E"); |
57 ClassElement F = env.getElement("F"); | 52 ClassElement F = env.getElement("F"); |
58 ClassElement G = env.getElement("G"); | 53 ClassElement G = env.getElement("G"); |
59 ClassElement H = env.getElement("H"); | 54 ClassElement H = env.getElement("H"); |
(...skipping 14 matching lines...) Expand all Loading... |
74 checkClass(B, [B, D, E]); | 69 checkClass(B, [B, D, E]); |
75 checkClass(C, [C, E, F, G, H, B, D, I]); | 70 checkClass(C, [C, E, F, G, H, B, D, I]); |
76 checkClass(D, [D]); | 71 checkClass(D, [D]); |
77 checkClass(E, [E]); | 72 checkClass(E, [E]); |
78 checkClass(F, [F]); | 73 checkClass(F, [F]); |
79 checkClass(G, [G]); | 74 checkClass(G, [G]); |
80 checkClass(H, [H, I]); | 75 checkClass(H, [H, I]); |
81 checkClass(I, [I]); | 76 checkClass(I, [I]); |
82 })); | 77 })); |
83 } | 78 } |
OLD | NEW |