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 dfee11b9ed64e51ad24b1c999842254f6b8a2854..8e9487b84c14cf71abf1188a6ceebbfae45e8610 100644 |
| --- a/pkg/analyzer/lib/src/task/dart.dart |
| +++ b/pkg/analyzer/lib/src/task/dart.dart |
| @@ -347,6 +347,22 @@ final ListResultDescriptor<AnalysisError> PARSE_ERRORS = |
| 'PARSE_ERRORS', AnalysisError.NO_ERRORS); |
| /** |
| + * The flag specifying that [LIBRARY_ELEMENT2] is ready for a library. |
|
Brian Wilkerson
2015/10/23 21:50:55
Maybe include a longer explanation here like the o
|
| + * |
| + * The result is only available for [Source]s representing a library. |
| + */ |
| +final ResultDescriptor<bool> READY_LIBRARY_ELEMENT2 = |
| + new ResultDescriptor<bool>('READY_LIBRARY_ELEMENT2', false); |
| + |
| +/** |
| + * The flag specifying that [LIBRARY_ELEMENT5] is ready for a library. |
| + * |
| + * The result is only available for [Source]s representing a library. |
| + */ |
| +final ResultDescriptor<bool> READY_LIBRARY_ELEMENT5 = |
| + new ResultDescriptor<bool>('READY_LIBRARY_ELEMENT5', false); |
| + |
| +/** |
| * The flag specifying that [RESOLVED_UNIT] is ready for a library. |
| * |
| * The result is only available for [Source]s representing a library. |
| @@ -1943,10 +1959,8 @@ class ComputeLibraryCycleTask extends SourceBasedAnalysisTask { |
| static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| LibrarySpecificUnit unit = target; |
| return <String, TaskInput>{ |
| - 'resolveReachableLibraries': IMPORT_EXPORT_SOURCE_CLOSURE |
| - .of(unit.library) |
| - .toListOf(LIBRARY_ELEMENT2), |
| - LIBRARY_ELEMENT_INPUT: LIBRARY_ELEMENT2.of(unit.library) |
| + LIBRARY_ELEMENT_INPUT: LIBRARY_ELEMENT2.of(unit.library), |
| + 'resolveReachableLibraries': READY_LIBRARY_ELEMENT2.of(unit.library), |
| }; |
| } |
| @@ -3478,9 +3492,7 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
| static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| LibrarySpecificUnit unit = target; |
| return <String, TaskInput>{ |
| - 'fullyBuiltLibraryElements': IMPORT_EXPORT_SOURCE_CLOSURE |
| - .of(unit.library) |
| - .toListOf(LIBRARY_ELEMENT5), |
| + 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library), |
| LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), |
| UNIT_INPUT: RESOLVED_UNIT4.of(unit), |
| TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| @@ -3545,6 +3557,125 @@ class PublicNamespaceBuilder { |
| } |
| /** |
| + * A task that ensures that [LIBRARY_ELEMENT2] is ready for every unit of the |
| + * target library source and its import/export closure. |
| + */ |
| +class ReadyLibraryElement2Task extends SourceBasedAnalysisTask { |
| + static const String IS_CLIENT_LIST_INPUT1 = 'IS_CLIENT_LIST_INPUT1'; |
| + static const String IS_CLIENT_LIST_INPUT2 = 'IS_CLIENT_LIST_INPUT2'; |
| + |
| + static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| + 'ReadyLibraryElement2Task', |
| + createTask, |
| + buildInputs, |
| + <ResultDescriptor>[READY_LIBRARY_ELEMENT2, IS_CLIENT]); |
| + |
| + ReadyLibraryElement2Task( |
| + InternalAnalysisContext context, AnalysisTarget target) |
| + : super(context, target); |
| + |
| + @override |
| + TaskDescriptor get descriptor => DESCRIPTOR; |
| + |
| + @override |
| + bool get handlesDependencyCycles => true; |
| + |
| + @override |
| + void internalPerform() { |
| + bool isClient = _isClient(); |
| + outputs[READY_LIBRARY_ELEMENT2] = true; |
| + outputs[IS_CLIENT] = isClient; |
| + } |
| + |
| + bool _isClient() { |
| + Source htmlSource = context.sourceFactory.forUri(DartSdk.DART_HTML); |
| + Source source = getRequiredSource(); |
| + if (source == htmlSource) { |
| + return true; |
| + } |
| + if (_hasTrueElement(getRequiredInput(IS_CLIENT_LIST_INPUT1))) { |
| + return true; |
| + } |
| + if (_hasTrueElement(getRequiredInput(IS_CLIENT_LIST_INPUT2))) { |
| + return true; |
| + } |
| + return false; |
| + } |
| + |
| + static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| + Source source = target; |
| + return <String, TaskInput>{ |
| + 'thisLibraryElementReady': LIBRARY_ELEMENT2.of(source), |
| + IS_CLIENT_LIST_INPUT1: IMPORTED_LIBRARIES.of(source).toListOf(IS_CLIENT), |
| + IS_CLIENT_LIST_INPUT2: EXPORTED_LIBRARIES.of(source).toListOf(IS_CLIENT), |
| + 'directlyImportedLibrariesReady': |
| + IMPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT2), |
| + 'directlyExportedLibrariesReady': |
| + EXPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT2), |
| + }; |
| + } |
| + |
| + static ReadyLibraryElement2Task createTask( |
| + AnalysisContext context, AnalysisTarget target) { |
| + return new ReadyLibraryElement2Task(context, target); |
| + } |
| + |
| + static bool _hasTrueElement(List<bool> elements) { |
| + if (elements != null) { |
| + for (bool isClient in elements) { |
| + if (isClient == true) { |
| + return true; |
| + } |
| + } |
| + } |
| + return false; |
| + } |
| +} |
| + |
| +/** |
| + * A task that ensures that [LIBRARY_ELEMENT5] is ready for every unit of the |
| + * target library source and its import/export closure. |
| + */ |
| +class ReadyLibraryElement5Task extends SourceBasedAnalysisTask { |
| + static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| + 'ReadyLibraryElement5Task', |
| + createTask, |
| + buildInputs, |
| + <ResultDescriptor>[READY_LIBRARY_ELEMENT5]); |
| + |
| + ReadyLibraryElement5Task( |
| + InternalAnalysisContext context, AnalysisTarget target) |
| + : super(context, target); |
| + |
| + @override |
| + TaskDescriptor get descriptor => DESCRIPTOR; |
| + |
| + @override |
| + bool get handlesDependencyCycles => true; |
| + |
| + @override |
| + void internalPerform() { |
| + outputs[READY_LIBRARY_ELEMENT5] = true; |
| + } |
| + |
| + static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| + Source source = target; |
| + return <String, TaskInput>{ |
| + 'thisLibraryElementReady': LIBRARY_ELEMENT5.of(source), |
| + 'directlyImportedLibrariesReady': |
| + IMPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT5), |
| + 'directlyExportedLibrariesReady': |
| + EXPORTED_LIBRARIES.of(source).toListOf(READY_LIBRARY_ELEMENT5), |
| + }; |
| + } |
| + |
| + static ReadyLibraryElement5Task createTask( |
| + AnalysisContext context, AnalysisTarget target) { |
| + return new ReadyLibraryElement5Task(context, target); |
| + } |
| +} |
| + |
| +/** |
| * A task that ensures that [RESOLVED_UNIT10] is ready for every unit of the |
| * target library source and its import/export closure. |
| */ |
| @@ -3963,7 +4094,7 @@ class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { |
| } |
| /** |
| - * An artifitial task that does nothing except to force type names resolution |
| + * An artificial task that does nothing except to force type names resolution |
| * for the defining and part units of a library. |
| */ |
| class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask { |