Index: pkg/analyzer/lib/src/context/context.dart |
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart |
index 394f30103715469a2c3bdbe5e45806739b53c2cd..7a608a8480722befa74275e4c0167318a597967a 100644 |
--- a/pkg/analyzer/lib/src/context/context.dart |
+++ b/pkg/analyzer/lib/src/context/context.dart |
@@ -1011,10 +1011,21 @@ class AnalysisContextImpl implements InternalAnalysisContext { |
@override |
bool handleContentsChanged( |
- Source source, String originalContents, String newContents, bool notify) { |
+ Source source, String originalContents, String newContents, bool notify, |
+ {bool explicit: false}) { |
+ explicit = explicit && (newContents != null); |
CacheEntry entry = _cache.get(source); |
if (entry == null) { |
- return false; |
+ if (explicit) { |
+ // Create it now. |
+ entry = _createCacheEntry(source, true); |
+ } else { |
+ return false; |
+ } |
+ } |
+ if (explicit) { |
+ // Mark as explicit whether there was any other change or not. |
+ entry.explicitlyAdded = true; |
} |
bool changed = newContents != originalContents; |
if (newContents != null) { |
@@ -1744,9 +1755,9 @@ class AnalysisContextImpl implements InternalAnalysisContext { |
void _sourceAvailable(Source source) { |
driver.reset(); |
// TODO(brianwilkerson) This method needs to check whether the source was |
- // previously being implicitly analyzed. If so, the cache entry needs to be |
- // update to reflect the new status and an event needs to be generated to |
- // inform clients that it is no longer being implicitly analyzed. |
+ // previously being implicitly analyzed. If so, an event needs to be |
+ // generated to inform clients that it is no longer being implicitly |
+ // analyzed. |
CacheEntry entry = _cache.get(source); |
if (entry == null) { |
_createCacheEntry(source, true); |