Index: pkg/analyzer_cli/lib/src/driver.dart |
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart |
index 8efdc2e10ecb448c4e5ce5691529270130a79f01..e993f1c10f1427a9a56b9f5cf0432f33fb35f630 100644 |
--- a/pkg/analyzer_cli/lib/src/driver.dart |
+++ b/pkg/analyzer_cli/lib/src/driver.dart |
@@ -180,7 +180,7 @@ class Driver implements CommandLineStarter { |
// Do analysis. |
if (options.buildMode) { |
- ErrorSeverity severity = _buildModeAnalyze(options); |
+ ErrorSeverity severity = await _buildModeAnalyze(options); |
// Propagate issues to the exit code. |
if (_shouldBeFatal(severity, options)) { |
io.exitCode = severity.ordinal; |
@@ -365,16 +365,20 @@ class Driver implements CommandLineStarter { |
} |
/// Perform analysis in build mode according to the given [options]. |
- ErrorSeverity _buildModeAnalyze(CommandLineOptions options) { |
- return _analyzeAllTag.makeCurrentWhile(() { |
+ Future<ErrorSeverity> _buildModeAnalyze(CommandLineOptions options) async { |
+ PerformanceTag previous = _analyzeAllTag.makeCurrent(); |
+ try { |
if (options.buildModePersistentWorker) { |
- new AnalyzerWorkerLoop.std(resourceProvider, |
+ await new AnalyzerWorkerLoop.std(resourceProvider, |
dartSdkPath: options.dartSdkPath) |
.run(); |
+ return ErrorSeverity.NONE; |
} else { |
- return new BuildMode(resourceProvider, options, stats).analyze(); |
+ return await new BuildMode(resourceProvider, options, stats).analyze(); |
} |
- }); |
+ } finally { |
+ previous.makeCurrent(); |
+ } |
} |
/// Decide on the appropriate policy for which files need to be fully parsed |