OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library jsinterop.world_test; | 5 library jsinterop.world_test; |
6 | 6 |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:compiler/src/common.dart'; | |
10 import 'package:compiler/src/elements/elements.dart' show ClassElement; | 9 import 'package:compiler/src/elements/elements.dart' show ClassElement; |
11 import 'package:compiler/src/elements/names.dart'; | 10 import 'package:compiler/src/elements/names.dart'; |
12 import 'package:compiler/src/js_backend/js_backend.dart'; | |
13 import 'package:compiler/src/universe/selector.dart'; | 11 import 'package:compiler/src/universe/selector.dart'; |
14 import 'package:compiler/src/world.dart'; | 12 import 'package:compiler/src/world.dart'; |
15 import '../type_test_helper.dart'; | 13 import '../type_test_helper.dart'; |
16 | 14 |
17 void main() { | 15 void main() { |
18 asyncTest(() async { | 16 asyncTest(() async { |
19 await testClasses(); | 17 await testClasses(); |
20 }); | 18 }); |
21 } | 19 } |
22 | 20 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 """, | 81 """, |
84 useMockCompiler: false); | 82 useMockCompiler: false); |
85 Map<String, ClassElement> classEnvironment = <String, ClassElement>{}; | 83 Map<String, ClassElement> classEnvironment = <String, ClassElement>{}; |
86 | 84 |
87 ClassElement registerClass(ClassElement cls) { | 85 ClassElement registerClass(ClassElement cls) { |
88 classEnvironment[cls.name] = cls; | 86 classEnvironment[cls.name] = cls; |
89 return cls; | 87 return cls; |
90 } | 88 } |
91 | 89 |
92 ClosedWorld world = env.closedWorld; | 90 ClosedWorld world = env.closedWorld; |
93 JavaScriptBackend backend = env.compiler.backend; | |
94 ClassElement Object_ = registerClass(world.commonElements.objectClass); | 91 ClassElement Object_ = registerClass(world.commonElements.objectClass); |
95 ClassElement Interceptor = | 92 ClassElement Interceptor = |
96 registerClass(world.commonElements.jsInterceptorClass); | 93 registerClass(world.commonElements.jsInterceptorClass); |
97 ClassElement JavaScriptObject = | 94 ClassElement JavaScriptObject = |
98 registerClass(world.commonElements.jsJavaScriptObjectClass); | 95 registerClass(world.commonElements.jsJavaScriptObjectClass); |
99 ClassElement A = registerClass(env.getElement('A')); | 96 ClassElement A = registerClass(env.getElement('A')); |
100 ClassElement B = registerClass(env.getElement('B')); | 97 ClassElement B = registerClass(env.getElement('B')); |
101 ClassElement C = registerClass(env.getElement('C')); | 98 ClassElement C = registerClass(env.getElement('C')); |
102 ClassElement D = registerClass(env.getElement('D')); | 99 ClassElement D = registerClass(env.getElement('D')); |
103 ClassElement E = registerClass(env.getElement('E')); | 100 ClassElement E = registerClass(env.getElement('E')); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 195 |
199 await test('main() => newE();', directlyInstantiated: ['E']); | 196 await test('main() => newE();', directlyInstantiated: ['E']); |
200 | 197 |
201 await test('main() => newF();', directlyInstantiated: ['F']); | 198 await test('main() => newF();', directlyInstantiated: ['F']); |
202 | 199 |
203 await test('main() => [newD(), newE()];', | 200 await test('main() => [newD(), newE()];', |
204 directlyInstantiated: ['E'], | 201 directlyInstantiated: ['E'], |
205 abstractlyInstantiated: ['A', 'B', 'C', 'D'], | 202 abstractlyInstantiated: ['A', 'B', 'C', 'D'], |
206 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); | 203 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); |
207 } | 204 } |
OLD | NEW |