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'; | 9 import 'package:compiler/src/common.dart'; |
10 import 'package:compiler/src/elements/elements.dart' show ClassElement; | 10 import 'package:compiler/src/elements/elements.dart' show ClassElement; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 useMockCompiler: false); | 84 useMockCompiler: false); |
85 Map<String, ClassElement> classEnvironment = <String, ClassElement>{}; | 85 Map<String, ClassElement> classEnvironment = <String, ClassElement>{}; |
86 | 86 |
87 ClassElement registerClass(ClassElement cls) { | 87 ClassElement registerClass(ClassElement cls) { |
88 classEnvironment[cls.name] = cls; | 88 classEnvironment[cls.name] = cls; |
89 return cls; | 89 return cls; |
90 } | 90 } |
91 | 91 |
92 ClosedWorld world = env.closedWorld; | 92 ClosedWorld world = env.closedWorld; |
93 JavaScriptBackend backend = env.compiler.backend; | 93 JavaScriptBackend backend = env.compiler.backend; |
94 ClassElement Object_ = | 94 ClassElement Object_ = registerClass(world.commonElements.objectClass); |
95 registerClass(env.compiler.commonElements.objectClass); | |
96 ClassElement Interceptor = | 95 ClassElement Interceptor = |
97 registerClass(env.compiler.commonElements.jsInterceptorClass); | 96 registerClass(world.commonElements.jsInterceptorClass); |
98 ClassElement JavaScriptObject = | 97 ClassElement JavaScriptObject = |
99 registerClass(env.compiler.commonElements.jsJavaScriptObjectClass); | 98 registerClass(world.commonElements.jsJavaScriptObjectClass); |
100 ClassElement A = registerClass(env.getElement('A')); | 99 ClassElement A = registerClass(env.getElement('A')); |
101 ClassElement B = registerClass(env.getElement('B')); | 100 ClassElement B = registerClass(env.getElement('B')); |
102 ClassElement C = registerClass(env.getElement('C')); | 101 ClassElement C = registerClass(env.getElement('C')); |
103 ClassElement D = registerClass(env.getElement('D')); | 102 ClassElement D = registerClass(env.getElement('D')); |
104 ClassElement E = registerClass(env.getElement('E')); | 103 ClassElement E = registerClass(env.getElement('E')); |
105 ClassElement F = registerClass(env.getElement('F')); | 104 ClassElement F = registerClass(env.getElement('F')); |
106 | 105 |
107 Selector nonExisting = new Selector.getter(const PublicName('nonExisting')); | 106 Selector nonExisting = new Selector.getter(const PublicName('nonExisting')); |
108 | 107 |
109 Expect.equals(Interceptor.superclass, Object_); | 108 Expect.equals(Interceptor.superclass, Object_); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 198 |
200 await test('main() => newE();', directlyInstantiated: ['E']); | 199 await test('main() => newE();', directlyInstantiated: ['E']); |
201 | 200 |
202 await test('main() => newF();', directlyInstantiated: ['F']); | 201 await test('main() => newF();', directlyInstantiated: ['F']); |
203 | 202 |
204 await test('main() => [newD(), newE()];', | 203 await test('main() => [newD(), newE()];', |
205 directlyInstantiated: ['E'], | 204 directlyInstantiated: ['E'], |
206 abstractlyInstantiated: ['A', 'B', 'C', 'D'], | 205 abstractlyInstantiated: ['A', 'B', 'C', 'D'], |
207 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); | 206 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); |
208 } | 207 } |
OLD | NEW |