Chromium Code Reviews| 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); |