Index: dart/pkg/dart2js_incremental/lib/caching_compiler.dart |
diff --git a/dart/pkg/dart2js_incremental/lib/caching_compiler.dart b/dart/pkg/dart2js_incremental/lib/caching_compiler.dart |
index afdf92f8ffd7beda7b2ee167f9366fd4c82349a5..9adf0b96e1d37b8e4fbc62d6f32c950ece293cd4 100644 |
--- a/dart/pkg/dart2js_incremental/lib/caching_compiler.dart |
+++ b/dart/pkg/dart2js_incremental/lib/caching_compiler.dart |
@@ -6,7 +6,7 @@ part of dart2js_incremental; |
/// Do not call this method directly. It will be made private. |
// TODO(ahe): Make this method private. |
-Compiler reuseCompiler( |
+Future<Compiler> reuseCompiler( |
{DiagnosticHandler diagnosticHandler, |
CompilerInputProvider inputProvider, |
CompilerOutputProvider outputProvider, |
@@ -16,7 +16,7 @@ Compiler reuseCompiler( |
Uri packageRoot, |
bool packagesAreImmutable: false, |
Map<String, dynamic> environment, |
- bool reuseLibrary(LibraryElement library)}) { |
+ Future<bool> reuseLibrary(LibraryElement library)}) { |
UserTag oldTag = new UserTag('_reuseCompiler').makeCurrent(); |
if (libraryRoot == null) { |
throw 'Missing libraryRoot'; |
@@ -55,14 +55,16 @@ Compiler reuseCompiler( |
print('Unable to reuse compiler.'); |
} |
} |
- compiler = new Compiler( |
- inputProvider, |
- outputProvider, |
- diagnosticHandler, |
- libraryRoot, |
- packageRoot, |
- options, |
- environment); |
+ oldTag.makeCurrent(); |
+ return new Future.value( |
+ new Compiler( |
+ inputProvider, |
+ outputProvider, |
+ diagnosticHandler, |
+ libraryRoot, |
+ packageRoot, |
+ options, |
+ environment)); |
} else { |
for (final task in compiler.tasks) { |
if (task.watch != null) { |
@@ -138,13 +140,14 @@ Compiler reuseCompiler( |
if (reuseLibrary == null) { |
reuseLibrary = (LibraryElement library) { |
- return |
+ return new Future.value( |
library.isPlatformLibrary || |
- (packagesAreImmutable && library.isPackageLibrary); |
+ (packagesAreImmutable && library.isPackageLibrary)); |
}; |
} |
- compiler.libraryLoader.reset(reuseLibrary: reuseLibrary); |
+ return compiler.libraryLoader.resetAsync(reuseLibrary).then((_) { |
+ oldTag.makeCurrent(); |
+ return compiler; |
+ }); |
} |
- oldTag.makeCurrent(); |
- return compiler; |
} |