Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2808173002: Prioritize analysis of files that import the changed file, or have an error or warning. (Closed)
Patch Set: Use separate buckets for each file category. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/file_state.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/analysis/file_state.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698