Index: pkg/analyzer/lib/src/dart/analysis/driver.dart |
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
index 871be4cfb0407f41a110328e54ddabf2f5db7c85..81b8f1cf1caae2e511dcff90cb7db4b6d5bc1b76 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
@@ -409,10 +409,19 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
} |
} |
} |
- if (_fileTracker.hasPendingFiles) { |
- return AnalysisDriverPriority.general; |
- } |
if (_fileTracker.hasChangedFiles) { |
+ return AnalysisDriverPriority.changedFiles; |
+ } |
+ if (_fileTracker.hasPendingChangedFiles) { |
+ return AnalysisDriverPriority.generalChanged; |
+ } |
+ if (_fileTracker.hasPendingImportFiles) { |
+ return AnalysisDriverPriority.generalImportChanged; |
+ } |
+ if (_fileTracker.hasPendingErrorFiles) { |
+ return AnalysisDriverPriority.generalWithErrors; |
+ } |
+ if (_fileTracker.hasPendingFiles) { |
return AnalysisDriverPriority.general; |
} |
if (_requestedParts.isNotEmpty || _partsToAnalyze.isNotEmpty) { |
@@ -1086,6 +1095,7 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
{String content, CompilationUnit resolvedUnit}) { |
var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes); |
List<AnalysisError> errors = _getErrorsFromSerialized(file, unit.errors); |
+ _updateHasErrorOrWarningFlag(file, errors); |
return new AnalysisResult( |
this, |
_sourceFactory, |
@@ -1242,6 +1252,23 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
return null; |
} |
} |
+ |
+ /** |
+ * Given the list of [errors] for the [file], update the [file]'s |
+ * [FileState.hasErrorOrWarning] flag. |
+ */ |
+ void _updateHasErrorOrWarningFlag( |
+ FileState file, List<AnalysisError> errors) { |
+ for (AnalysisError error in errors) { |
+ ErrorSeverity severity = error.errorCode.errorSeverity; |
+ if (severity == ErrorSeverity.ERROR || |
+ severity == ErrorSeverity.WARNING) { |
+ file.hasErrorOrWarning = true; |
+ return; |
+ } |
+ } |
+ file.hasErrorOrWarning = false; |
+ } |
} |
/** |
@@ -1277,7 +1304,16 @@ abstract class AnalysisDriverGeneric { |
* of the list, the earlier the corresponding [AnalysisDriver] should be asked |
* to perform work. |
*/ |
-enum AnalysisDriverPriority { nothing, general, priority, interactive } |
+enum AnalysisDriverPriority { |
+ nothing, |
+ general, |
+ generalWithErrors, |
+ generalImportChanged, |
+ generalChanged, |
+ changedFiles, |
+ priority, |
+ interactive |
+} |
/** |
* Instances of this class schedule work in multiple [AnalysisDriver]s so that |