Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/FileChangedTask.java |
=================================================================== |
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/FileChangedTask.java (revision 10235) |
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/analysis/FileChangedTask.java (working copy) |
@@ -14,6 +14,7 @@ |
package com.google.dart.tools.core.analysis; |
import java.io.File; |
+import java.util.Collection; |
/** |
* Update the model given that that specified file has changed |
@@ -52,8 +53,17 @@ |
// Discard and re-analyze only if this library is not already up to date |
if (file.lastModified() != library.lastModified(file)) { |
task = new LibraryScanTask(server, context, file, true); |
- task.addFilesToScan(library.getSourceFiles()); |
+ // Discard and scan any libraries that were incorrectly sourced |
+ Collection<File> sourceFiles = library.getSourceFiles(); |
+ task.addFilesToScan(sourceFiles); |
+ for (File sourceFile : sourceFiles) { |
+ Library sourcedLibrary = context.getCachedLibrary(sourceFile); |
+ if (sourcedLibrary != null) { |
+ context.discardLibrary(sourcedLibrary); |
+ } |
+ } |
+ |
// Discard the library and any downstream libraries |
context.discardLibraryAndReferencingLibraries(library); |
} |