| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.context.context; | 5 library analyzer.src.context.context; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1864 if (oldUnit != null) { | 1864 if (oldUnit != null) { |
| 1865 CompilationUnit newUnit = parseCompilationUnit(source); | 1865 CompilationUnit newUnit = parseCompilationUnit(source); |
| 1866 IncrementalCompilationUnitElementBuilder builder = | 1866 IncrementalCompilationUnitElementBuilder builder = |
| 1867 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit); | 1867 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit); |
| 1868 builder.build(); | 1868 builder.build(); |
| 1869 CompilationUnitElementDelta unitDelta = builder.unitDelta; | 1869 CompilationUnitElementDelta unitDelta = builder.unitDelta; |
| 1870 if (!unitDelta.hasDirectiveChange) { | 1870 if (!unitDelta.hasDirectiveChange) { |
| 1871 unitEntry.setValueIncremental( | 1871 unitEntry.setValueIncremental( |
| 1872 COMPILATION_UNIT_CONSTANTS, builder.unitConstants, false); | 1872 COMPILATION_UNIT_CONSTANTS, builder.unitConstants, false); |
| 1873 DartDelta dartDelta = new DartDelta(source); | 1873 DartDelta dartDelta = new DartDelta(source); |
| 1874 dartDelta.hasDirectiveChange = unitDelta.hasDirectiveChange; | |
| 1875 unitDelta.addedDeclarations.forEach(dartDelta.elementChanged); | 1874 unitDelta.addedDeclarations.forEach(dartDelta.elementChanged); |
| 1876 unitDelta.removedDeclarations.forEach(dartDelta.elementChanged); | 1875 unitDelta.removedDeclarations.forEach(dartDelta.elementChanged); |
| 1877 unitDelta.classDeltas.values.forEach(dartDelta.classChanged); | 1876 unitDelta.classDeltas.values.forEach(dartDelta.classChanged); |
| 1878 // Add other names in the library that are changed transitively. | |
| 1879 { | |
| 1880 ReferencedNames referencedNames = new ReferencedNames(source); | |
| 1881 new ReferencedNamesBuilder(referencedNames).build(oldUnit); | |
| 1882 dartDelta.addChangedElements(referencedNames, librarySource); | |
| 1883 } | |
| 1884 // Invalidate using the prepared DartDelta. | |
| 1885 entry.setState(CONTENT, CacheState.INVALID, delta: dartDelta); | 1877 entry.setState(CONTENT, CacheState.INVALID, delta: dartDelta); |
| 1886 return; | 1878 return; |
| 1887 } | 1879 } |
| 1888 } | 1880 } |
| 1889 } | 1881 } |
| 1890 } | 1882 } |
| 1891 entry.setState(CONTENT, CacheState.INVALID); | 1883 entry.setState(CONTENT, CacheState.INVALID); |
| 1892 entry.setState(MODIFICATION_TIME, CacheState.INVALID); | 1884 entry.setState(MODIFICATION_TIME, CacheState.INVALID); |
| 1893 entry.setState(SOURCE_KIND, CacheState.INVALID); | 1885 entry.setState(SOURCE_KIND, CacheState.INVALID); |
| 1894 } | 1886 } |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2302 } | 2294 } |
| 2303 DartSdk sdk = factory.dartSdk; | 2295 DartSdk sdk = factory.dartSdk; |
| 2304 if (sdk == null) { | 2296 if (sdk == null) { |
| 2305 throw new IllegalArgumentException( | 2297 throw new IllegalArgumentException( |
| 2306 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2298 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
| 2307 } | 2299 } |
| 2308 return new AnalysisCache( | 2300 return new AnalysisCache( |
| 2309 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2301 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
| 2310 } | 2302 } |
| 2311 } | 2303 } |
| OLD | NEW |