OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 that the additional runtime type support is output to the right | 5 // Test that the additional runtime type support is output to the right |
6 // Files when using deferred loading. | 6 // Files when using deferred loading. |
7 | 7 |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:compiler/src/compiler.dart'; | 9 import 'package:compiler/src/compiler.dart'; |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
11 import 'memory_compiler.dart'; | 11 import 'memory_compiler.dart'; |
12 import 'output_collector.dart'; | 12 import 'output_collector.dart'; |
13 | 13 |
14 void main() { | 14 void main() { |
15 asyncTest(() async { | 15 asyncTest(() async { |
16 OutputCollector collector = new OutputCollector(); | 16 OutputCollector collector = new OutputCollector(); |
17 CompilationResult result = await runCompiler( | 17 CompilationResult result = await runCompiler( |
18 memorySourceFiles: MEMORY_SOURCE_FILES, | 18 memorySourceFiles: MEMORY_SOURCE_FILES, |
19 outputProvider: collector); | 19 outputProvider: collector); |
20 Compiler compiler = result.compiler; | 20 Compiler compiler = result.compiler; |
21 | 21 |
22 lookupLibrary(name) { | 22 lookupLibrary(name) { |
23 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); | 23 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); |
24 } | 24 } |
25 | 25 |
26 var main = compiler.mainApp.find(Compiler.MAIN); | 26 var main = compiler.mainFunction; |
27 Expect.isNotNull(main, "Could not find 'main'"); | 27 Expect.isNotNull(main, "Could not find 'main'"); |
28 compiler.deferredLoadTask.onResolutionComplete(main); | 28 compiler.deferredLoadTask.onResolutionComplete(main); |
29 | 29 |
30 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; | 30 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; |
31 | 31 |
32 var lib1 = lookupLibrary("memory:lib1.dart"); | 32 var lib1 = lookupLibrary("memory:lib1.dart"); |
33 var foo1 = lib1.find("foo"); | 33 var foo1 = lib1.find("foo"); |
34 var ou_lib1 = outputUnitForElement(foo1); | 34 var ou_lib1 = outputUnitForElement(foo1); |
35 | 35 |
36 var lib2 = lookupLibrary("memory:lib2.dart"); | 36 var lib2 = lookupLibrary("memory:lib2.dart"); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 """, "lib2.dart": """ | 136 """, "lib2.dart": """ |
137 import "main.dart" as main; | 137 import "main.dart" as main; |
138 const C4 = "string4"; | 138 const C4 = "string4"; |
139 const C5 = const main.C(1); | 139 const C5 = const main.C(1); |
140 const C6 = const main.C(2); | 140 const C6 = const main.C(2); |
141 foo() { | 141 foo() { |
142 print("lib2"); | 142 print("lib2"); |
143 main.foo(); | 143 main.foo(); |
144 } | 144 } |
145 """}; | 145 """}; |
OLD | NEW |