Index: dart/tests/compiler/dart2js/memory_compiler.dart |
diff --git a/dart/tests/compiler/dart2js/memory_compiler.dart b/dart/tests/compiler/dart2js/memory_compiler.dart |
index a45e1ca27695eae95ab54c4f5fb5c0a8d648b8c3..5418963d726074a823ec6aa4cf37c9be3453d8a1 100644 |
--- a/dart/tests/compiler/dart2js/memory_compiler.dart |
+++ b/dart/tests/compiler/dart2js/memory_compiler.dart |
@@ -20,7 +20,8 @@ import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirro |
Compiler compilerFor(Map<String,String> memorySourceFiles, |
{DiagnosticHandler diagnosticHandler, |
- List<String> options: const []}) { |
+ List<String> options: const [], |
+ Compiler cachedCompiler}) { |
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script)); |
Uri libraryRoot = script.resolve('../../../sdk/'); |
Uri packageRoot = script.resolve('./packages/'); |
@@ -42,6 +43,37 @@ Compiler compilerFor(Map<String,String> memorySourceFiles, |
libraryRoot, |
packageRoot, |
options); |
+ if (cachedCompiler != null) { |
+ compiler.coreLibrary = cachedCompiler.libraries['dart:core']; |
+ compiler.types = cachedCompiler.types; |
+ cachedCompiler.libraries.forEach((String uri, library) { |
+ if (library.isPlatformLibrary) { |
+ compiler.libraries[uri] = library; |
+ compiler.onLibraryScanned(library, library.canonicalUri); |
+ } |
+ }); |
+ |
+ compiler.symbolConstructor = cachedCompiler.symbolConstructor; |
+ compiler.mirrorSystemClass = cachedCompiler.mirrorSystemClass; |
+ compiler.mirrorsUsedClass = cachedCompiler.mirrorsUsedClass; |
+ compiler.mirrorSystemGetNameFunction = |
+ cachedCompiler.mirrorSystemGetNameFunction; |
+ compiler.symbolImplementationClass = |
+ cachedCompiler.symbolImplementationClass; |
+ compiler.symbolValidatedConstructor = |
+ cachedCompiler.symbolValidatedConstructor; |
+ compiler.mirrorsUsedConstructor = cachedCompiler.mirrorsUsedConstructor; |
+ compiler.deferredLibraryClass = cachedCompiler.deferredLibraryClass; |
+ |
+ Map cachedTreeElements = |
+ cachedCompiler.enqueuer.resolution.resolvedElements; |
+ cachedTreeElements.forEach((element, treeElements) { |
+ if (element.getLibrary().isPlatformLibrary) { |
+ compiler.enqueuer.resolution.resolvedElements[element] = |
+ treeElements; |
+ } |
+ }); |
+ } |
return compiler; |
} |