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 Element, ClassElement; | 10 import 'package:compiler/src/elements/elements.dart' show Element, ClassElement; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 $mainSource | 79 $mainSource |
80 """, | 80 """, |
81 useMockCompiler: false); | 81 useMockCompiler: false); |
82 Map<String, ClassElement> classEnvironment = <String, ClassElement>{}; | 82 Map<String, ClassElement> classEnvironment = <String, ClassElement>{}; |
83 | 83 |
84 ClassElement registerClass(ClassElement cls) { | 84 ClassElement registerClass(ClassElement cls) { |
85 classEnvironment[cls.name] = cls; | 85 classEnvironment[cls.name] = cls; |
86 return cls; | 86 return cls; |
87 } | 87 } |
88 | 88 |
89 ClassWorld world = env.compiler.closedWorld; | 89 ClosedWorld world = env.compiler.closedWorld; |
90 JavaScriptBackend backend = env.compiler.backend; | 90 JavaScriptBackend backend = env.compiler.backend; |
91 ClassElement Object_ = registerClass(env.compiler.coreClasses.objectClass); | 91 ClassElement Object_ = registerClass(env.compiler.coreClasses.objectClass); |
92 ClassElement Interceptor = | 92 ClassElement Interceptor = |
93 registerClass(backend.helpers.jsInterceptorClass); | 93 registerClass(backend.helpers.jsInterceptorClass); |
94 ClassElement JavaScriptObject = | 94 ClassElement JavaScriptObject = |
95 registerClass(backend.helpers.jsJavaScriptObjectClass); | 95 registerClass(backend.helpers.jsJavaScriptObjectClass); |
96 ClassElement A = registerClass(env.getElement('A')); | 96 ClassElement A = registerClass(env.getElement('A')); |
97 ClassElement B = registerClass(env.getElement('B')); | 97 ClassElement B = registerClass(env.getElement('B')); |
98 ClassElement C = registerClass(env.getElement('C')); | 98 ClassElement C = registerClass(env.getElement('C')); |
99 ClassElement D = registerClass(env.getElement('D')); | 99 ClassElement D = registerClass(env.getElement('D')); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); | 155 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); |
156 | 156 |
157 await test('main() => newE();', directlyInstantiated: ['E']); | 157 await test('main() => newE();', directlyInstantiated: ['E']); |
158 | 158 |
159 await test('main() => newF();', directlyInstantiated: ['F']); | 159 await test('main() => newF();', directlyInstantiated: ['F']); |
160 | 160 |
161 await test('main() => [newD(), newE()];', | 161 await test('main() => [newD(), newE()];', |
162 directlyInstantiated: ['A', 'B', 'C', 'D', 'E'], | 162 directlyInstantiated: ['A', 'B', 'C', 'D', 'E'], |
163 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); | 163 indirectlyInstantiated: ['Object', 'Interceptor', 'JavaScriptObject']); |
164 } | 164 } |
OLD | NEW |