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