OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.test.memory_compiler; | 5 library dart2js.test.memory_compiler; |
6 | 6 |
7 import 'memory_source_file_helper.dart'; | 7 import 'memory_source_file_helper.dart'; |
8 | 8 |
9 import 'package:compiler/implementation/dart2jslib.dart' | 9 import 'package:compiler/implementation/dart2jslib.dart' |
10 show NullSink; | 10 show NullSink; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 Compiler compiler = new Compiler(readStringFromUri, | 159 Compiler compiler = new Compiler(readStringFromUri, |
160 outputProvider, | 160 outputProvider, |
161 handler, | 161 handler, |
162 libraryRoot, | 162 libraryRoot, |
163 packageRoot, | 163 packageRoot, |
164 options, | 164 options, |
165 {}); | 165 {}); |
166 if (cachedCompiler != null) { | 166 if (cachedCompiler != null) { |
167 compiler.coreLibrary = cachedCompiler.libraries['dart:core']; | 167 compiler.coreLibrary = |
| 168 cachedCompiler.libraryLoader.lookupLibrary(Uri.parse('dart:core')); |
168 compiler.types = cachedCompiler.types.copy(compiler); | 169 compiler.types = cachedCompiler.types.copy(compiler); |
169 Map copiedLibraries = {}; | 170 Map copiedLibraries = {}; |
170 cachedCompiler.libraries.forEach((String uri, library) { | 171 cachedCompiler.libraryLoader.libraries.forEach((library) { |
171 if (library.isPlatformLibrary) { | 172 if (library.isPlatformLibrary) { |
| 173 compiler.libraryLoader.mapLibrary(library); |
172 compiler.onLibraryCreated(library); | 174 compiler.onLibraryCreated(library); |
173 compiler.libraries[uri] = library; | |
174 // TODO(johnniwinther): Assert that no libraries are created lazily from | |
175 // this call. | |
176 compiler.onLibraryScanned(library, null); | 175 compiler.onLibraryScanned(library, null); |
177 if (library.isPatched) { | 176 if (library.isPatched) { |
178 var patchLibrary = library.patch; | 177 var patchLibrary = library.patch; |
179 compiler.onLibraryCreated(patchLibrary); | 178 compiler.onLibraryCreated(patchLibrary); |
180 // TODO(johnniwinther): Assert that no libraries are created lazily | |
181 // from this call. | |
182 compiler.onLibraryScanned(patchLibrary, null); | 179 compiler.onLibraryScanned(patchLibrary, null); |
183 } | 180 } |
184 copiedLibraries[library.canonicalUri] = library; | 181 copiedLibraries[library.canonicalUri] = library; |
185 } | 182 } |
186 }); | 183 }); |
187 // TODO(johnniwinther): Assert that no libraries are loaded lazily from | 184 // TODO(johnniwinther): Assert that no libraries are loaded lazily from |
188 // this call. | 185 // this call. |
189 compiler.onLibrariesLoaded(copiedLibraries); | 186 compiler.onLibrariesLoaded(copiedLibraries); |
190 | 187 |
191 compiler.symbolConstructor = cachedCompiler.symbolConstructor; | 188 compiler.symbolConstructor = cachedCompiler.symbolConstructor; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); | 245 createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics); |
249 | 246 |
250 List<Uri> libraries = <Uri>[]; | 247 List<Uri> libraries = <Uri>[]; |
251 memorySourceFiles.forEach((String path, _) { | 248 memorySourceFiles.forEach((String path, _) { |
252 libraries.add(new Uri(scheme: 'memory', path: path)); | 249 libraries.add(new Uri(scheme: 'memory', path: path)); |
253 }); | 250 }); |
254 | 251 |
255 return analyze(libraries, libraryRoot, packageRoot, | 252 return analyze(libraries, libraryRoot, packageRoot, |
256 provider, handler, options); | 253 provider, handler, options); |
257 } | 254 } |
OLD | NEW |