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 da2436d23b5d0b430474827a8d6d7a3ae07b7245..f95375865fe3d4f43fd4ba3321b9de0adb4ad9c4 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
@@ -480,6 +480,13 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
} |
if (AnalysisEngine.isDartFileName(path)) { |
_fileTracker.addFile(path); |
+ // If the file is known, it has already been read, even if it did not |
+ // exist. Now we are notified that the file exists, so we need to |
+ // re-read it and make sure that we invalidate signature of the files |
+ // that reference it. |
+ if (_fsState.knownFilePaths.contains(path)) { |
+ _changeFile(path); |
+ } |
} |
} |
@@ -503,8 +510,7 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
*/ |
void changeFile(String path) { |
_throwIfChangesAreNotAllowed(); |
- _fileTracker.changeFile(path); |
- _priorityResults.clear(); |
+ _changeFile(path); |
} |
/** |
@@ -947,6 +953,14 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
} |
/** |
+ * Implementation for [changeFile]. |
+ */ |
+ void _changeFile(String path) { |
+ _fileTracker.changeFile(path); |
+ _priorityResults.clear(); |
+ } |
+ |
+ /** |
* Handles a notification from the [FileTracker] that there has been a change |
* of state. |
*/ |