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/compiler_new.dart'; | 9 import 'package:compiler/compiler_new.dart'; |
10 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
(...skipping 12 matching lines...) Expand all Loading... |
23 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); | 23 return compiler.libraryLoader.lookupLibrary(Uri.parse(name)); |
24 } | 24 } |
25 | 25 |
26 var main = compiler.frontendStrategy.elementEnvironment.mainFunction; | 26 var main = compiler.frontendStrategy.elementEnvironment.mainFunction; |
27 Expect.isNotNull(main, "Could not find 'main'"); | 27 Expect.isNotNull(main, "Could not find 'main'"); |
28 compiler.deferredLoadTask.onResolutionComplete( | 28 compiler.deferredLoadTask.onResolutionComplete( |
29 main, compiler.resolutionWorldBuilder.closedWorldForTesting); | 29 main, compiler.resolutionWorldBuilder.closedWorldForTesting); |
30 | 30 |
31 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; | 31 var outputUnitForElement = compiler.deferredLoadTask.outputUnitForElement; |
32 | 32 |
33 var lib1 = lookupLibrary("memory:lib1.dart"); | 33 dynamic lib1 = lookupLibrary("memory:lib1.dart"); |
34 var foo1 = lib1.find("foo"); | 34 var foo1 = lib1.find("foo"); |
35 var ou_lib1 = outputUnitForElement(foo1); | 35 var ou_lib1 = outputUnitForElement(foo1); |
36 | 36 |
37 var lib2 = lookupLibrary("memory:lib2.dart"); | 37 dynamic lib2 = lookupLibrary("memory:lib2.dart"); |
38 var foo2 = lib2.find("foo"); | 38 var foo2 = lib2.find("foo"); |
39 var ou_lib2 = outputUnitForElement(foo2); | 39 var ou_lib2 = outputUnitForElement(foo2); |
40 | 40 |
41 var mainApp = compiler.frontendStrategy.elementEnvironment.mainLibrary; | 41 dynamic mainApp = compiler.frontendStrategy.elementEnvironment.mainLibrary; |
42 var fooMain = mainApp.find("foo"); | 42 var fooMain = mainApp.find("foo"); |
43 var ou_lib1_lib2 = outputUnitForElement(fooMain); | 43 var ou_lib1_lib2 = outputUnitForElement(fooMain); |
44 | 44 |
45 String mainOutput = collector.getOutput("", OutputType.js); | 45 String mainOutput = collector.getOutput("", OutputType.js); |
46 String lib1Output = | 46 String lib1Output = |
47 collector.getOutput("out_${ou_lib1.name}", OutputType.jsPart); | 47 collector.getOutput("out_${ou_lib1.name}", OutputType.jsPart); |
48 String lib2Output = | 48 String lib2Output = |
49 collector.getOutput("out_${ou_lib2.name}", OutputType.jsPart); | 49 collector.getOutput("out_${ou_lib2.name}", OutputType.jsPart); |
50 String lib12Output = | 50 String lib12Output = |
51 collector.getOutput("out_${ou_lib1_lib2.name}", OutputType.jsPart); | 51 collector.getOutput("out_${ou_lib1_lib2.name}", OutputType.jsPart); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 import "main.dart" as main; | 144 import "main.dart" as main; |
145 const C4 = "string4"; | 145 const C4 = "string4"; |
146 const C5 = const main.C(1); | 146 const C5 = const main.C(1); |
147 const C6 = const main.C(2); | 147 const C6 = const main.C(2); |
148 foo() { | 148 foo() { |
149 print("lib2"); | 149 print("lib2"); |
150 main.foo(); | 150 main.foo(); |
151 } | 151 } |
152 """ | 152 """ |
153 }; | 153 }; |
OLD | NEW |