Chromium Code Reviews| Index: pkg/analyzer/lib/src/task/dart.dart |
| diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart |
| index 3e0b4fb7d26992a58db8776ad48a1acb19c76bd5..040050a83e375c072074709befd37c2ad33adf0f 100644 |
| --- a/pkg/analyzer/lib/src/task/dart.dart |
| +++ b/pkg/analyzer/lib/src/task/dart.dart |
| @@ -439,7 +439,7 @@ final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT1 = |
| /** |
| * The partial [LibraryElement] associated with a library. |
| * |
| - * In addition to [LIBRARY_ELEMENT1] [LibraryElement.imports] and |
| + * In addition to [LIBRARY_ELEMENT1] also [LibraryElement.imports] and |
| * [LibraryElement.exports] are set. |
| * |
| * The result is only available for [Source]s representing a library. |
| @@ -2228,6 +2228,7 @@ class ComputeLibraryCycleTask extends SourceBasedAnalysisTask { |
| * given [target]. |
| */ |
| static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| + // TODO(scheglov) Why the target is LibrarySpecificUnit? |
|
Brian Wilkerson
2016/06/27 13:59:00
This is addressed by another CL.
|
| LibrarySpecificUnit unit = target; |
| return <String, TaskInput>{ |
| LIBRARY_ELEMENT_INPUT: LIBRARY_ELEMENT2.of(unit.library), |
| @@ -2548,25 +2549,32 @@ class DartDelta extends Delta { |
| if (target is Element) { |
| targetSource = target.source; |
| } |
| - // Keep results that are updated incrementally. |
| - // If we want to analyze only some references to the source being changed, |
| - // we need to keep the same instances of CompilationUnitElement and |
| - // LibraryElement. |
| + // Keep results that don't change: any library. |
| + if (_isTaskResult(BuildLibraryElementTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult(BuildDirectiveElementsTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult(ResolveDirectiveElementsTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult(BuildEnumMemberElementsTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult(BuildSourceExportClosureTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult(ReadyLibraryElement2Task.DESCRIPTOR, descriptor) || |
| + _isTaskResult(ComputeLibraryCycleTask.DESCRIPTOR, descriptor)) { |
| + return DeltaResult.KEEP_CONTINUE; |
| + } |
| + // Keep results that don't change: changed library. |
| if (targetSource == source) { |
| - if (ScanDartTask.DESCRIPTOR.results.contains(descriptor)) { |
| - return DeltaResult.KEEP_CONTINUE; |
| - } |
| - if (ParseDartTask.DESCRIPTOR.results.contains(descriptor)) { |
| - return DeltaResult.KEEP_CONTINUE; |
| - } |
| - if (BuildCompilationUnitElementTask.DESCRIPTOR.results |
| - .contains(descriptor)) { |
| + if (_isTaskResult(ScanDartTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult(ParseDartTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult( |
| + BuildCompilationUnitElementTask.DESCRIPTOR, descriptor) || |
| + _isTaskResult(BuildLibraryElementTask.DESCRIPTOR, descriptor)) { |
| return DeltaResult.KEEP_CONTINUE; |
| } |
| - if (BuildLibraryElementTask.DESCRIPTOR.results.contains(descriptor)) { |
| + return DeltaResult.INVALIDATE; |
| + } |
| + // Keep results that don't change: dependent library. |
| + if (targetSource != source) { |
| + if (_isTaskResult(BuildPublicNamespaceTask.DESCRIPTOR, descriptor)) { |
| return DeltaResult.KEEP_CONTINUE; |
| } |
| - return DeltaResult.INVALIDATE; |
| } |
| // Use the target library dependency information to decide whether |
| // the delta affects the library. |
| @@ -2594,6 +2602,11 @@ class DartDelta extends Delta { |
| } |
| static bool _isPrivateName(String name) => name.startsWith('_'); |
| + |
| + static bool _isTaskResult( |
| + TaskDescriptor taskDescriptor, ResultDescriptor result) { |
| + return taskDescriptor.results.contains(result); |
| + } |
| } |
| /** |