Chromium Code Reviews| 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]; |
| }); |