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

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

Issue 2808173002: Prioritize analysis of files that import the changed file, or have an error or warning. (Closed)
Patch Set: 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
Index: pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
index aa34c330ee5e599ed87680bd815bb182a2cc67e1..3419cb4fe3c5d8f1f92e20e7cd89c8e0ec10cf51 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_tracker.dart
@@ -61,7 +61,7 @@ class FileTracker {
/**
* The set of files that are currently scheduled for analysis.
*/
- final _pendingFiles = new LinkedHashSet<String>();
+ var _pendingFiles = new LinkedHashSet<String>();
FileTracker(
this.logger,
@@ -172,7 +172,39 @@ class FileTracker {
if (anyApiChanged) {
logger.writeln('API signatures mismatch found for $path');
// TODO(scheglov) schedule analysis of only affected files
- _pendingFiles.addAll(addedFiles);
+ var pendingFiles = new LinkedHashSet<String>();
+
+ // Add the changed file.
+ if (addedFiles.contains(path)) {
+ pendingFiles.add(path);
+ }
+
+ // Add files that directly import the changed file.
+ for (String addedPath in addedFiles) {
+ FileState addedFile = fsState.getFileForPath(addedPath);
+ for (FileState changedFile in files) {
+ if (addedFile.importedFiles.contains(changedFile)) {
+ pendingFiles.add(addedPath);
+ }
+ }
+ }
+
+ // Add files with errors or warnings that might be fixed.
+ for (String addedPath in addedFiles) {
+ FileState addedFile = fsState.getFileForPath(addedPath);
+ if (addedFile.hasErrorOrWarning) {
+ pendingFiles.add(addedPath);
+ }
+ }
+
+ // Add all previous pending files.
+ pendingFiles.addAll(_pendingFiles);
Brian Wilkerson 2017/04/10 18:17:38 Are we sure we want to add previous pending files
scheglov 2017/04/10 18:51:58 Well, we would need a way to distinguish which fil
+
+ // Add all the rest.
+ pendingFiles.addAll(addedFiles);
+
+ // Replace pending files.
+ _pendingFiles = pendingFiles;
}
return files[0];
});
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/file_state.dart ('k') | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698