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

Unified Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1218503003: Don't remove ResultData(s) for incrementally updated results. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Disable 'limitInvalidationInTaskModel' Created 5 years, 6 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 | « pkg/analyzer/lib/src/context/cache.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 071165804559efe37cacb3808742f2603494cce5..67c86b19a6f12a1c699c15a6174969931fa45ec4 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -1727,24 +1727,33 @@ class AnalysisContextImpl implements InternalAnalysisContext {
AnalysisEngine.isDartFileName(source.fullName)) {
// TODO(scheglov) Incorrect implementation in general.
entry.setState(TOKEN_STREAM, CacheState.FLUSHED);
- entry.setState(SCAN_ERRORS, CacheState.FLUSHED);
entry.setState(PARSED_UNIT, CacheState.FLUSHED);
- entry.setState(PARSE_ERRORS, CacheState.FLUSHED);
- CompilationUnit oldUnit = getResolvedCompilationUnit2(source, source);
- if (oldUnit != null) {
- CompilationUnit newUnit = parseCompilationUnit(source);
- IncrementalCompilationUnitElementBuilder builder =
- new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit);
- builder.build();
- CompilationUnitElementDelta unitDelta = builder.unitDelta;
- DartDelta dartDelta = new DartDelta(source);
- dartDelta.hasDirectiveChange = unitDelta.hasDirectiveChange;
- unitDelta.addedDeclarations.forEach(dartDelta.elementAdded);
- unitDelta.removedDeclarations.forEach(dartDelta.elementRemoved);
- delta = dartDelta;
+ List<Source> librarySources = getLibrariesContaining(source);
+ if (librarySources.length == 1) {
+ Source librarySource = librarySources[0];
+ CompilationUnit oldUnit =
+ getResolvedCompilationUnit2(source, librarySource);
+ if (oldUnit != null) {
+ CompilationUnit newUnit = parseCompilationUnit(source);
+ IncrementalCompilationUnitElementBuilder builder =
+ new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit);
+ builder.build();
+ CompilationUnitElementDelta unitDelta = builder.unitDelta;
+ if (!unitDelta.hasDirectiveChange) {
+ DartDelta dartDelta = new DartDelta(source);
+ dartDelta.hasDirectiveChange = unitDelta.hasDirectiveChange;
+ unitDelta.addedDeclarations.forEach(dartDelta.elementAdded);
+ unitDelta.removedDeclarations.forEach(dartDelta.elementRemoved);
+ print(
Brian Wilkerson 2015/06/26 16:12:07 Remove or comment out debugging statement?
+ 'dartDelta: add=${dartDelta.addedNames} remove=${dartDelta.removedNames}');
+ delta = dartDelta;
+ entry.setState(CONTENT, CacheState.INVALID, delta: delta);
+ return;
+ }
+ }
}
}
- entry.setState(CONTENT, CacheState.INVALID, delta: delta);
+ entry.setState(CONTENT, CacheState.INVALID);
}
dartWorkManager.applyChange(
Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST);
« no previous file with comments | « pkg/analyzer/lib/src/context/cache.dart ('k') | pkg/analyzer/lib/src/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698