Index: dart/site/try/poi/poi.dart |
diff --git a/dart/site/try/poi/poi.dart b/dart/site/try/poi/poi.dart |
index 21b1078704f77f9509df2c7872a9035cc4226392..0261ba5584fd39fa79b24a3f391446f1ad6060d9 100644 |
--- a/dart/site/try/poi/poi.dart |
+++ b/dart/site/try/poi/poi.dart |
@@ -397,22 +397,35 @@ Future<Element> runPoi( |
options.add('--minify'); |
} |
- LibraryUpdater updater = |
- new LibraryUpdater( |
- cachedCompiler, inputProvider, script, printWallClock, printVerbose); |
+ LibraryUpdater updater; |
+ |
Future<bool> reuseLibrary(LibraryElement library) { |
return poiTask.measure(() => updater.reuseLibrary(library)); |
} |
- return reuseCompiler( |
- diagnosticHandler: handler, |
- inputProvider: inputProvider, |
- options: options, |
- cachedCompiler: cachedCompiler, |
- libraryRoot: libraryRoot, |
- packageRoot: packageRoot, |
- packagesAreImmutable: true, |
- reuseLibrary: reuseLibrary).then((Compiler newCompiler) { |
+ Future<Compiler> invokeReuseCompiler() { |
+ updater = new LibraryUpdater( |
+ cachedCompiler, inputProvider, script, printWallClock, printVerbose); |
+ return reuseCompiler( |
+ diagnosticHandler: handler, |
+ inputProvider: inputProvider, |
+ options: options, |
+ cachedCompiler: cachedCompiler, |
+ libraryRoot: libraryRoot, |
+ packageRoot: packageRoot, |
+ packagesAreImmutable: true, |
+ reuseLibrary: reuseLibrary); |
+ } |
+ |
+ return invokeReuseCompiler().then((Compiler newCompiler) { |
+ // TODO(ahe): Move this "then" block to [reuseCompiler]. |
+ if (updater.failed) { |
+ cachedCompiler = null; |
+ return invokeReuseCompiler(); |
+ } else { |
+ return newCompiler; |
+ } |
+ }).then((Compiler newCompiler) { |
if (!isCompiler) { |
newCompiler.enqueuerFilter = new ScriptOnlyFilter(script); |
} |