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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 845813006: When the file content is the same as the being removed overlay contents, ignore the change. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 173735221af803dc8873784685a3a38a83ec1ed8..c82d274d4c4c486e520af4279a6db3dca5a4cfac 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -3215,8 +3215,27 @@ class AnalysisContextImpl implements InternalAnalysisContext {
} else if (originalContents != null) {
_incrementalAnalysisCache =
IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source);
- _sourceChanged(source);
changed = true;
+ // We are removing the overlay for the file, check if the file's
+ // contents is the same as it was in the overlay.
+ SourceEntry sourceEntry = _cache.get(source);
+ if (sourceEntry != null) {
+ try {
+ TimestampedData<String> fileContents = getContents(source);
+ String fileContentsData = fileContents.data;
+ if (fileContentsData == originalContents) {
+ sourceEntry.modificationTime = fileContents.modificationTime;
+ sourceEntry.setValue(SourceEntry.CONTENT, fileContentsData);
+ changed = false;
+ }
+ } catch (e) {
+ }
+ }
+ // If not the same content (e.g. the file is being closed without save),
+ // then force analysis.
+ if (changed) {
+ _sourceChanged(source);
+ }
}
return changed;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698