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 8418715ff2ca6f3eb8bec4a74467aef2b070f1a7..cb5791c51cee09960597d71cbdb7f476a1cbe623 100644 |
--- a/pkg/analyzer/lib/src/task/dart.dart |
+++ b/pkg/analyzer/lib/src/task/dart.dart |
@@ -246,15 +246,6 @@ final ResultDescriptor<bool> CREATED_RESOLVED_UNIT12 = |
new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT12', false); |
/** |
- * The flag specifying that [RESOLVED_UNIT13] has been been computed for this |
- * compilation unit (without requiring that the AST for it still be in cache). |
- * |
- * The result is only available for [LibrarySpecificUnit]s. |
- */ |
-final ResultDescriptor<bool> CREATED_RESOLVED_UNIT13 = |
- new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT13', false); |
- |
-/** |
* The flag specifying that [RESOLVED_UNIT2] has been been computed for this |
* compilation unit (without requiring that the AST for it still be in cache). |
* |
@@ -526,7 +517,7 @@ final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT6 = |
/** |
* The partial [LibraryElement] associated with a library. |
* |
- * [LIBRARY_ELEMENT6] plus propagated types for propagable variables. |
+ * [LIBRARY_ELEMENT6] plus [RESOLVED_UNIT7] for all library units. |
* |
* The result is only available for [Source]s representing a library. |
*/ |
@@ -635,36 +626,6 @@ final ListResultDescriptor<PendingError> PENDING_ERRORS = |
'PENDING_ERRORS', const <PendingError>[]); |
/** |
- * A list of the [VariableElement]s whose type should be known to propagate |
- * the type of another variable (the target). |
- * |
- * The result is only available for [VariableElement]s. |
- */ |
-final ListResultDescriptor<VariableElement> PROPAGABLE_VARIABLE_DEPENDENCIES = |
- new ListResultDescriptor<VariableElement>( |
- 'PROPAGABLE_VARIABLE_DEPENDENCIES', null); |
- |
-/** |
- * A list of the [VariableElement]s defined in a unit whose type might be |
- * propagated. This includes variables defined at the library level as well as |
- * static and instance members inside classes. |
- * |
- * The result is only available for [LibrarySpecificUnit]s. |
- */ |
-final ListResultDescriptor<VariableElement> PROPAGABLE_VARIABLES_IN_UNIT = |
- new ListResultDescriptor<VariableElement>( |
- 'PROPAGABLE_VARIABLES_IN_UNIT', null); |
- |
-/** |
- * An propagable variable ([VariableElement]) whose type has been propagated. |
- * |
- * The result is only available for [VariableElement]s. |
- */ |
-final ResultDescriptor<VariableElement> PROPAGATED_VARIABLE = |
- new ResultDescriptor<VariableElement>('PROPAGATED_VARIABLE', null, |
- cachingPolicy: ELEMENT_CACHING_POLICY); |
- |
-/** |
* The flag specifying that [LIBRARY_ELEMENT2] is ready for a library and its |
* import/export closure. |
* |
@@ -776,11 +737,9 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = |
cachingPolicy: AST_REUSABLE_CACHING_POLICY); |
/** |
- * The partially resolved [CompilationUnit] associated with a compilation unit. |
- * |
- * In addition to what is true of a [RESOLVED_UNIT9], tasks that use this value |
- * as an input can assume that the initializers of instance variables have been |
- * re-resolved. |
+ * The resolved [CompilationUnit] associated with a compilation unit in which |
+ * the types of class members have been inferred in addition to everything that |
+ * is true of a [RESOLVED_UNIT9]. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -789,9 +748,8 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT10 = |
cachingPolicy: AST_CACHING_POLICY); |
/** |
- * The resolved [CompilationUnit] associated with a compilation unit in which |
- * the types of class members have been inferred in addition to everything that |
- * is true of a [RESOLVED_UNIT10]. |
+ * The resolved [CompilationUnit] associated with a compilation unit, with |
+ * constants not yet resolved. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -801,7 +759,7 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT11 = |
/** |
* The resolved [CompilationUnit] associated with a compilation unit, with |
- * constants not yet resolved. |
+ * constants resolved. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -810,16 +768,6 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT12 = |
cachingPolicy: AST_CACHING_POLICY); |
/** |
- * The resolved [CompilationUnit] associated with a compilation unit, with |
- * constants resolved. |
- * |
- * The result is only available for [LibrarySpecificUnit]s. |
- */ |
-final ResultDescriptor<CompilationUnit> RESOLVED_UNIT13 = |
- new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT13', null, |
- cachingPolicy: AST_CACHING_POLICY); |
- |
-/** |
* The partially resolved [CompilationUnit] associated with a compilation unit. |
* |
* In addition to what is true of a [RESOLVED_UNIT1], tasks that use this value |
@@ -902,8 +850,7 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT7 = |
* The partially resolved [CompilationUnit] associated with a compilation unit. |
* |
* In addition to what is true of a [RESOLVED_UNIT7], tasks that use this value |
- * as an input can assume that the types of final variables have been |
- * propagated. |
+ * as an input can assume that the types of static variables have been inferred. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -915,7 +862,8 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT8 = |
* The partially resolved [CompilationUnit] associated with a compilation unit. |
* |
* In addition to what is true of a [RESOLVED_UNIT8], tasks that use this value |
- * as an input can assume that the types of static variables have been inferred. |
+ * as an input can assume that the initializers of instance variables have been |
+ * re-resolved. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -940,7 +888,6 @@ final List<ResultDescriptor<CompilationUnit>> RESOLVED_UNIT_RESULTS = |
RESOLVED_UNIT10, |
RESOLVED_UNIT11, |
RESOLVED_UNIT12, |
- RESOLVED_UNIT13, |
RESOLVED_UNIT |
]; |
@@ -2303,85 +2250,6 @@ class ComputeLibraryCycleTask extends SourceBasedAnalysisTask { |
} |
/** |
- * A task that computes the [PROPAGABLE_VARIABLE_DEPENDENCIES] for a variable. |
- */ |
-class ComputePropagableVariableDependenciesTask |
- extends InferStaticVariableTask { |
- /** |
- * The name of the [RESOLVED_UNIT7] input. |
- */ |
- static const String UNIT_INPUT = 'UNIT_INPUT'; |
- |
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
- 'ComputePropagableVariableDependenciesTask', |
- createTask, |
- buildInputs, |
- <ResultDescriptor>[PROPAGABLE_VARIABLE_DEPENDENCIES]); |
- |
- ComputePropagableVariableDependenciesTask( |
- InternalAnalysisContext context, VariableElement variable) |
- : super(context, variable); |
- |
- @override |
- TaskDescriptor get descriptor => DESCRIPTOR; |
- |
- @override |
- void internalPerform() { |
- // |
- // Prepare inputs. |
- // |
- CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
- // |
- // Compute dependencies. |
- // |
- VariableDeclaration declaration = getDeclaration(unit); |
- VariableGatherer gatherer = new VariableGatherer(_isPropagable); |
- declaration.initializer.accept(gatherer); |
- // |
- // Record outputs. |
- // |
- outputs[PROPAGABLE_VARIABLE_DEPENDENCIES] = gatherer.results.toList(); |
- } |
- |
- /** |
- * Return `true` if the given [variable] is a variable whose type can be |
- * propagated. |
- */ |
- bool _isPropagable(VariableElement variable) => |
- variable is PropertyInducingElement && |
- (variable.isConst || variable.isFinal) && |
- variable.hasImplicitType && |
- variable.initializer != null; |
- |
- /** |
- * Return a map from the names of the inputs of this kind of task to the task |
- * input descriptors describing those inputs for a task with the |
- * given [target]. |
- */ |
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
- if (target is VariableElement) { |
- CompilationUnitElementImpl unit = target |
- .getAncestor((Element element) => element is CompilationUnitElement); |
- return <String, TaskInput>{ |
- UNIT_INPUT: RESOLVED_UNIT7 |
- .of(new LibrarySpecificUnit(unit.librarySource, unit.source)) |
- }; |
- } |
- throw new AnalysisException( |
- 'Cannot build inputs for a ${target.runtimeType}'); |
- } |
- |
- /** |
- * Create a [ComputePropagableVariableDependenciesTask] based on the |
- * given [target] in the given [context]. |
- */ |
- static ComputePropagableVariableDependenciesTask createTask( |
- AnalysisContext context, AnalysisTarget target) { |
- return new ComputePropagableVariableDependenciesTask(context, target); |
- } |
-} |
- |
-/** |
* A task that builds [REQUIRED_CONSTANTS] for a unit. |
*/ |
class ComputeRequiredConstantsTask extends SourceBasedAnalysisTask { |
@@ -3006,11 +2874,11 @@ class DartErrorsTask extends SourceBasedAnalysisTask { |
} |
/** |
- * A task that builds [RESOLVED_UNIT13] for a unit. |
+ * A task that builds [RESOLVED_UNIT12] for a unit. |
*/ |
class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
/** |
- * The name of the [RESOLVED_UNIT12] input. |
+ * The name of the [RESOLVED_UNIT11] input. |
*/ |
static const String UNIT_INPUT = 'UNIT_INPUT'; |
@@ -3026,7 +2894,7 @@ class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
'EvaluateUnitConstantsTask', |
createTask, |
buildInputs, |
- <ResultDescriptor>[CREATED_RESOLVED_UNIT13, RESOLVED_UNIT13]); |
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT12, RESOLVED_UNIT12]); |
EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) |
: super(context, target); |
@@ -3039,8 +2907,8 @@ class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
// No actual work needs to be performed; the task manager will ensure that |
// all constants are evaluated before this method is called. |
CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
- outputs[RESOLVED_UNIT13] = unit; |
- outputs[CREATED_RESOLVED_UNIT13] = true; |
+ outputs[RESOLVED_UNIT12] = unit; |
+ outputs[CREATED_RESOLVED_UNIT12] = true; |
} |
/** |
@@ -3052,7 +2920,7 @@ class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
LibrarySpecificUnit unit = target; |
return <String, TaskInput>{ |
'libraryElement': LIBRARY_ELEMENT9.of(unit.library), |
- UNIT_INPUT: RESOLVED_UNIT12.of(unit), |
+ UNIT_INPUT: RESOLVED_UNIT11.of(unit), |
CONSTANT_VALUES: |
COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE), |
'constantExpressionsDependencies': |
@@ -3075,7 +2943,7 @@ class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
*/ |
class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
/** |
- * The name of the [RESOLVED_UNIT12] input. |
+ * The name of the [RESOLVED_UNIT11] input. |
*/ |
static const String UNIT_INPUT = 'UNIT_INPUT'; |
@@ -3119,7 +2987,7 @@ class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
*/ |
static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
LibrarySpecificUnit unit = target; |
- return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT12.of(unit)}; |
+ return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)}; |
} |
/** |
@@ -3137,7 +3005,7 @@ class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
*/ |
class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
/** |
- * The name of the [RESOLVED_UNIT12] input. |
+ * The name of the [RESOLVED_UNIT11] input. |
*/ |
static const String UNIT_INPUT = 'UNIT_INPUT'; |
@@ -3181,7 +3049,7 @@ class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
*/ |
static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
LibrarySpecificUnit unit = target; |
- return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT12.of(unit)}; |
+ return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)}; |
} |
/** |
@@ -3199,7 +3067,7 @@ class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
*/ |
class GenerateHintsTask extends SourceBasedAnalysisTask { |
/** |
- * The name of the [RESOLVED_UNIT12] input. |
+ * The name of the [RESOLVED_UNIT11] input. |
*/ |
static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; |
@@ -3497,7 +3365,7 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { |
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
/** |
- * The name of the input whose value is the [RESOLVED_UNIT9] for the |
+ * The name of the input whose value is the [RESOLVED_UNIT8] for the |
* compilation unit. |
*/ |
static const String UNIT_INPUT = 'UNIT_INPUT'; |
@@ -3509,7 +3377,7 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { |
'InferInstanceMembersInUnitTask', |
createTask, |
buildInputs, |
- <ResultDescriptor>[CREATED_RESOLVED_UNIT11, RESOLVED_UNIT11]); |
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT10, RESOLVED_UNIT10]); |
/** |
* Initialize a newly created task to build a library element for the given |
@@ -3541,8 +3409,8 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { |
// |
// Record outputs. |
// |
- outputs[RESOLVED_UNIT11] = unit; |
- outputs[CREATED_RESOLVED_UNIT11] = true; |
+ outputs[RESOLVED_UNIT10] = unit; |
+ outputs[CREATED_RESOLVED_UNIT10] = true; |
} |
/** |
@@ -3553,7 +3421,7 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { |
static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
LibrarySpecificUnit unit = target; |
return <String, TaskInput>{ |
- UNIT_INPUT: RESOLVED_UNIT10.of(unit), |
+ UNIT_INPUT: RESOLVED_UNIT9.of(unit), |
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
// In strong mode, add additional dependencies to enforce inference |
// ordering. |
@@ -3561,14 +3429,14 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { |
// Require that field re-resolution be complete for all units in the |
// current library cycle. |
'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit.library).toList( |
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( |
new LibrarySpecificUnit( |
(unit as CompilationUnitElementImpl).librarySource, |
unit.source))), |
// Require that full inference be complete for all dependencies of the |
// current library cycle. |
'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit.library).toList( |
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT11.of( |
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
new LibrarySpecificUnit( |
(unit as CompilationUnitElementImpl).librarySource, |
unit.source))) |
@@ -3672,8 +3540,8 @@ class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
'InferStaticVariableTypesInUnitTask', |
createTask, |
buildInputs, <ResultDescriptor>[ |
- CREATED_RESOLVED_UNIT9, |
- RESOLVED_UNIT9, |
+ CREATED_RESOLVED_UNIT8, |
+ RESOLVED_UNIT8, |
STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT |
]); |
@@ -3700,8 +3568,8 @@ class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
// because the work has implicitly been done by virtue of the task model |
// preparing all of the inputs. |
// |
- outputs[RESOLVED_UNIT9] = unit; |
- outputs[CREATED_RESOLVED_UNIT9] = true; |
+ outputs[RESOLVED_UNIT8] = unit; |
+ outputs[CREATED_RESOLVED_UNIT8] = true; |
outputs[STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT] = |
AnalysisError.mergeLists(errorLists); |
} |
@@ -3720,7 +3588,7 @@ class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
ERRORS_LIST_INPUT: INFERABLE_STATIC_VARIABLES_IN_UNIT |
.of(unit) |
.toListOf(STATIC_VARIABLE_RESOLUTION_ERRORS), |
- UNIT_INPUT: RESOLVED_UNIT8.of(unit) |
+ UNIT_INPUT: RESOLVED_UNIT7.of(unit) |
}; |
} |
@@ -3848,14 +3716,14 @@ class InferStaticVariableTypeTask extends InferStaticVariableTask { |
.of(variable) |
.toListOf(INFERRED_STATIC_VARIABLE), |
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
- UNIT_INPUT: RESOLVED_UNIT8.of(unit), |
+ UNIT_INPUT: RESOLVED_UNIT7.of(unit), |
// In strong mode, add additional dependencies to enforce inference |
// ordering. |
// Require that full inference be complete for all dependencies of the |
// current library cycle. |
'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit.library).toList( |
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT11.of( |
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
new LibrarySpecificUnit( |
(unit as CompilationUnitElementImpl).librarySource, |
unit.source))) |
@@ -4315,7 +4183,6 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
createTask, |
buildInputs, <ResultDescriptor>[ |
INFERABLE_STATIC_VARIABLES_IN_UNIT, |
- PROPAGABLE_VARIABLES_IN_UNIT, |
CREATED_RESOLVED_UNIT7, |
RESOLVED_UNIT7 |
]); |
@@ -4350,7 +4217,6 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
} else { |
outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = VariableElement.EMPTY_LIST; |
} |
- outputs[PROPAGABLE_VARIABLES_IN_UNIT] = visitor.propagableVariables; |
outputs[RESOLVED_UNIT7] = unit; |
outputs[CREATED_RESOLVED_UNIT7] = true; |
} |
@@ -4373,7 +4239,7 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
// Require that full inference be complete for all dependencies of the |
// current library cycle. |
'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit.library).toList( |
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT11.of( |
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
new LibrarySpecificUnit( |
(unit as CompilationUnitElementImpl).librarySource, |
unit.source))) |
@@ -4391,295 +4257,6 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
} |
/** |
- * An artificial task that does nothing except to force propagated types for |
- * all propagable variables in the import/export closure a library. |
- */ |
-class PropagateVariableTypesInLibraryClosureTask |
- extends SourceBasedAnalysisTask { |
- /** |
- * The name of the [LIBRARY_ELEMENT7] input. |
- */ |
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
- |
- /** |
- * The task descriptor describing this kind of task. |
- */ |
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
- 'PropagateVariableTypesInLibraryClosureTask', |
- createTask, |
- buildInputs, |
- <ResultDescriptor>[LIBRARY_ELEMENT8]); |
- |
- PropagateVariableTypesInLibraryClosureTask( |
- InternalAnalysisContext context, AnalysisTarget target) |
- : super(context, target); |
- |
- @override |
- TaskDescriptor get descriptor => DESCRIPTOR; |
- |
- @override |
- void internalPerform() { |
- LibraryElement library = getRequiredInput(LIBRARY_INPUT); |
- outputs[LIBRARY_ELEMENT8] = library; |
- } |
- |
- /** |
- * Return a map from the names of the inputs of this kind of task to the task |
- * input descriptors describing those inputs for a task with the |
- * given [target]. |
- */ |
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
- Source source = target; |
- return <String, TaskInput>{ |
- 'readyForClosure': READY_LIBRARY_ELEMENT7.of(source), |
- LIBRARY_INPUT: LIBRARY_ELEMENT7.of(source), |
- }; |
- } |
- |
- /** |
- * Create a [PropagateVariableTypesInLibraryClosureTask] based on the given |
- * [target] in the given [context]. |
- */ |
- static PropagateVariableTypesInLibraryClosureTask createTask( |
- AnalysisContext context, AnalysisTarget target) { |
- return new PropagateVariableTypesInLibraryClosureTask(context, target); |
- } |
-} |
- |
-/** |
- * An artificial task that does nothing except to force propagated types for |
- * all propagable variables in the defining and part units of a library. |
- */ |
-class PropagateVariableTypesInLibraryTask extends SourceBasedAnalysisTask { |
- /** |
- * The name of the [LIBRARY_ELEMENT6] input. |
- */ |
- static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
- |
- /** |
- * The task descriptor describing this kind of task. |
- */ |
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
- 'PropagateVariableTypesInLibraryTask', |
- createTask, |
- buildInputs, |
- <ResultDescriptor>[LIBRARY_ELEMENT7]); |
- |
- PropagateVariableTypesInLibraryTask( |
- InternalAnalysisContext context, AnalysisTarget target) |
- : super(context, target); |
- |
- @override |
- TaskDescriptor get descriptor => DESCRIPTOR; |
- |
- @override |
- void internalPerform() { |
- LibraryElement library = getRequiredInput(LIBRARY_INPUT); |
- outputs[LIBRARY_ELEMENT7] = library; |
- } |
- |
- /** |
- * Return a map from the names of the inputs of this kind of task to the task |
- * input descriptors describing those inputs for a task with the |
- * given [target]. |
- */ |
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
- Source source = target; |
- return <String, TaskInput>{ |
- 'propagatedVariableTypesInUnits': |
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT8), |
- LIBRARY_INPUT: LIBRARY_ELEMENT6.of(source), |
- }; |
- } |
- |
- /** |
- * Create a [PropagateVariableTypesInLibraryTask] based on the given [target] |
- * in the given [context]. |
- */ |
- static PropagateVariableTypesInLibraryTask createTask( |
- AnalysisContext context, AnalysisTarget target) { |
- return new PropagateVariableTypesInLibraryTask(context, target); |
- } |
-} |
- |
-/** |
- * A task that ensures that all of the propagable variables in a compilation |
- * unit have had their type propagated. |
- */ |
-class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
- /** |
- * The name of the input whose value is the [RESOLVED_UNIT7] for the |
- * compilation unit. |
- */ |
- static const String UNIT_INPUT = 'UNIT_INPUT'; |
- |
- /** |
- * The task descriptor describing this kind of task. |
- */ |
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
- 'PropagateVariableTypesInUnitTask', |
- createTask, |
- buildInputs, |
- <ResultDescriptor>[CREATED_RESOLVED_UNIT8, RESOLVED_UNIT8]); |
- |
- PropagateVariableTypesInUnitTask( |
- InternalAnalysisContext context, LibrarySpecificUnit unit) |
- : super(context, unit); |
- |
- @override |
- TaskDescriptor get descriptor => DESCRIPTOR; |
- |
- @override |
- void internalPerform() { |
- // |
- // Prepare inputs. |
- // |
- CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
- // |
- // Record outputs. There is no additional work to be done at this time |
- // because the work has implicitly been done by virtue of the task model |
- // preparing all of the inputs. |
- // |
- outputs[RESOLVED_UNIT8] = unit; |
- outputs[CREATED_RESOLVED_UNIT8] = true; |
- } |
- |
- /** |
- * Return a map from the names of the inputs of this kind of task to the task |
- * input descriptors describing those inputs for a task with the given |
- * [target]. |
- */ |
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
- LibrarySpecificUnit unit = target; |
- return <String, TaskInput>{ |
- 'variables': |
- PROPAGABLE_VARIABLES_IN_UNIT.of(unit).toListOf(PROPAGATED_VARIABLE), |
- UNIT_INPUT: RESOLVED_UNIT7.of(unit) |
- }; |
- } |
- |
- /** |
- * Create a [PropagateVariableTypesInUnitTask] based on the given [target] |
- * in the given [context]. |
- */ |
- static PropagateVariableTypesInUnitTask createTask( |
- AnalysisContext context, AnalysisTarget target) { |
- return new PropagateVariableTypesInUnitTask(context, target); |
- } |
-} |
- |
-/** |
- * A task that computes the propagated type of an propagable variable and |
- * stores it in the element model. |
- */ |
-class PropagateVariableTypeTask extends InferStaticVariableTask { |
- /** |
- * The name of the [TYPE_PROVIDER] input. |
- */ |
- static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
- |
- /** |
- * The name of the [RESOLVED_UNIT7] input. |
- */ |
- static const String UNIT_INPUT = 'UNIT_INPUT'; |
- |
- static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
- 'PropagateVariableTypeTask', |
- createTask, |
- buildInputs, |
- <ResultDescriptor>[PROPAGATED_VARIABLE]); |
- |
- PropagateVariableTypeTask( |
- InternalAnalysisContext context, VariableElement variable) |
- : super(context, variable); |
- |
- @override |
- TaskDescriptor get descriptor => DESCRIPTOR; |
- |
- @override |
- bool get handlesDependencyCycles => true; |
- |
- @override |
- void internalPerform() { |
- // |
- // Prepare inputs. |
- // |
- PropertyInducingElementImpl variable = target; |
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
- CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
- |
- // If we're not in a dependency cycle, and we have no type annotation, |
- // re-resolve the right hand side and do propagation. |
- if (dependencyCycle == null && variable.hasImplicitType) { |
- VariableDeclaration declaration = getDeclaration(unit); |
- // |
- // Re-resolve the variable's initializer with the propagated types of |
- // other variables. |
- // |
- Expression initializer = declaration.initializer; |
- ResolutionContext resolutionContext = ResolutionContextBuilder.contextFor( |
- initializer, AnalysisErrorListener.NULL_LISTENER); |
- ResolverVisitor visitor = new ResolverVisitor(variable.library, |
- variable.source, typeProvider, AnalysisErrorListener.NULL_LISTENER, |
- nameScope: resolutionContext.scope); |
- if (resolutionContext.enclosingClassDeclaration != null) { |
- visitor.prepareToResolveMembersInClass( |
- resolutionContext.enclosingClassDeclaration); |
- } |
- visitor.initForIncrementalResolution(); |
- initializer.accept(visitor); |
- // |
- // Record the type of the variable. |
- // |
- DartType newType = initializer.bestType; |
- if (newType != null && !newType.isBottom && !newType.isDynamic) { |
- variable.propagatedType = newType; |
- } |
- } |
- // |
- // Record outputs. |
- // |
- outputs[PROPAGATED_VARIABLE] = variable; |
- } |
- |
- /** |
- * Return a map from the names of the inputs of this kind of task to the task |
- * input descriptors describing those inputs for a task with the given |
- * [target]. |
- */ |
- static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
- VariableElement variable = target; |
- if (variable.library == null) { |
- StringBuffer buffer = new StringBuffer(); |
- buffer.write( |
- 'PropagateVariableTypeTask building inputs for a variable with no library. Variable name = "'); |
- buffer.write(variable.name); |
- buffer.write('". Path = '); |
- (variable as ElementImpl).appendPathTo(buffer); |
- throw new AnalysisException(buffer.toString()); |
- } |
- LibrarySpecificUnit unit = |
- new LibrarySpecificUnit(variable.library.source, variable.source); |
- return <String, TaskInput>{ |
- 'dependencies': PROPAGABLE_VARIABLE_DEPENDENCIES |
- .of(variable) |
- .toListOf(PROPAGATED_VARIABLE), |
- TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
- UNIT_INPUT: RESOLVED_UNIT7.of(unit), |
- }; |
- } |
- |
- /** |
- * Create a [PropagateVariableTypeTask] based on the given [target] in the |
- * given [context]. |
- */ |
- static PropagateVariableTypeTask createTask( |
- AnalysisContext context, AnalysisTarget target) { |
- return new PropagateVariableTypeTask(context, target); |
- } |
-} |
- |
-/** |
* A task that ensures that [LIBRARY_ELEMENT2] is ready for the target library |
* source and its import/export closure. |
*/ |
@@ -4769,14 +4346,14 @@ class ReadyLibraryElement5Task extends SourceBasedAnalysisTask { |
* A task that ensures that [LIBRARY_ELEMENT7] is ready for the target library |
* source and its import/export closure. |
*/ |
-class ReadyLibraryElement6Task extends SourceBasedAnalysisTask { |
+class ReadyLibraryElement7Task extends SourceBasedAnalysisTask { |
static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
- 'ReadyLibraryElement6Task', |
+ 'ReadyLibraryElement7Task', |
createTask, |
buildInputs, |
<ResultDescriptor>[READY_LIBRARY_ELEMENT7]); |
- ReadyLibraryElement6Task( |
+ ReadyLibraryElement7Task( |
InternalAnalysisContext context, AnalysisTarget target) |
: super(context, target); |
@@ -4802,9 +4379,9 @@ class ReadyLibraryElement6Task extends SourceBasedAnalysisTask { |
}; |
} |
- static ReadyLibraryElement6Task createTask( |
+ static ReadyLibraryElement7Task createTask( |
AnalysisContext context, AnalysisTarget target) { |
- return new ReadyLibraryElement6Task(context, target); |
+ return new ReadyLibraryElement7Task(context, target); |
} |
} |
@@ -5293,7 +4870,7 @@ class ResolveConstantExpressionTask extends ConstantEvaluationAnalysisTask { |
'Cannot build inputs for a ${target.runtimeType}'); |
} |
return <String, TaskInput>{ |
- 'createdResolvedUnit': CREATED_RESOLVED_UNIT12 |
+ 'createdResolvedUnit': CREATED_RESOLVED_UNIT11 |
.of(new LibrarySpecificUnit(librarySource, target.source)) |
}; |
} |
@@ -5383,6 +4960,117 @@ class ResolveDirectiveElementsTask extends SourceBasedAnalysisTask { |
} |
/** |
+ * An artificial task that does nothing except to force [LIBRARY_ELEMENT7] for |
+ * the target library and its import/export closure. |
+ */ |
+class ResolvedUnit7InLibraryClosureTask extends SourceBasedAnalysisTask { |
+ /** |
+ * The name of the [LIBRARY_ELEMENT7] input. |
+ */ |
+ static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
+ |
+ /** |
+ * The task descriptor describing this kind of task. |
+ */ |
+ static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
+ 'ResolvedUnit7InLibraryClosureTask', |
+ createTask, |
+ buildInputs, |
+ <ResultDescriptor>[LIBRARY_ELEMENT8]); |
+ |
+ ResolvedUnit7InLibraryClosureTask( |
+ InternalAnalysisContext context, AnalysisTarget target) |
+ : super(context, target); |
+ |
+ @override |
+ TaskDescriptor get descriptor => DESCRIPTOR; |
+ |
+ @override |
+ void internalPerform() { |
+ LibraryElement library = getRequiredInput(LIBRARY_INPUT); |
+ outputs[LIBRARY_ELEMENT8] = library; |
+ } |
+ |
+ /** |
+ * Return a map from the names of the inputs of this kind of task to the task |
+ * input descriptors describing those inputs for a task with the |
+ * given [target]. |
+ */ |
+ static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
+ Source source = target; |
+ return <String, TaskInput>{ |
+ 'readyForClosure': READY_LIBRARY_ELEMENT7.of(source), |
+ LIBRARY_INPUT: LIBRARY_ELEMENT7.of(source), |
+ }; |
+ } |
+ |
+ /** |
+ * Create a [ResolvedUnit7InLibraryClosureTask] based on the given |
+ * [target] in the given [context]. |
+ */ |
+ static ResolvedUnit7InLibraryClosureTask createTask( |
+ AnalysisContext context, AnalysisTarget target) { |
+ return new ResolvedUnit7InLibraryClosureTask(context, target); |
+ } |
+} |
+ |
+/** |
+ * An artificial task that does nothing except to force [LIBRARY_ELEMENT6] and |
+ * [RESOLVED_UNIT7] in the defining and part units of a library. |
+ */ |
+class ResolvedUnit7InLibraryTask extends SourceBasedAnalysisTask { |
+ /** |
+ * The name of the [LIBRARY_ELEMENT6] input. |
+ */ |
+ static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
+ |
+ /** |
+ * The task descriptor describing this kind of task. |
+ */ |
+ static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
+ 'ResolvedUnit7InLibraryTask', |
+ createTask, |
+ buildInputs, |
+ <ResultDescriptor>[LIBRARY_ELEMENT7]); |
+ |
+ ResolvedUnit7InLibraryTask( |
+ InternalAnalysisContext context, AnalysisTarget target) |
+ : super(context, target); |
+ |
+ @override |
+ TaskDescriptor get descriptor => DESCRIPTOR; |
+ |
+ @override |
+ void internalPerform() { |
+ LibraryElement library = getRequiredInput(LIBRARY_INPUT); |
+ outputs[LIBRARY_ELEMENT7] = library; |
+ } |
+ |
+ /** |
+ * Return a map from the names of the inputs of this kind of task to the task |
+ * input descriptors describing those inputs for a task with the |
+ * given [target]. |
+ */ |
+ static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
+ Source source = target; |
+ return <String, TaskInput>{ |
+ 'resolvedUnits': |
+ LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT7), |
+ LIBRARY_INPUT: LIBRARY_ELEMENT6.of(source), |
+ }; |
+ } |
+ |
+ /** |
+ * Create a [ResolvedUnit7InLibraryTask] based on the given [target] |
+ * in the given [context]. |
+ */ |
+ static ResolvedUnit7InLibraryTask createTask( |
+ AnalysisContext context, AnalysisTarget target) { |
+ return new ResolvedUnit7InLibraryTask(context, target); |
+ } |
+} |
+ |
+/** |
* A task that ensures that all of the inferable instance members in a |
* compilation unit have had their right hand sides re-resolved |
*/ |
@@ -5398,7 +5086,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { |
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
/** |
- * The name of the input whose value is the [RESOLVED_UNIT9] for the |
+ * The name of the input whose value is the [RESOLVED_UNIT8] for the |
* compilation unit. |
*/ |
static const String UNIT_INPUT = 'UNIT_INPUT'; |
@@ -5410,7 +5098,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { |
'ResolveInstanceFieldsInUnitTask', |
createTask, |
buildInputs, |
- <ResultDescriptor>[CREATED_RESOLVED_UNIT10, RESOLVED_UNIT10]); |
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT9, RESOLVED_UNIT9]); |
/** |
* Initialize a newly created task to build a library element for the given |
@@ -5447,8 +5135,8 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { |
// |
// Record outputs. |
// |
- outputs[RESOLVED_UNIT10] = unit; |
- outputs[CREATED_RESOLVED_UNIT10] = true; |
+ outputs[RESOLVED_UNIT9] = unit; |
+ outputs[CREATED_RESOLVED_UNIT9] = true; |
} |
/** |
@@ -5459,7 +5147,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { |
static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
LibrarySpecificUnit unit = target; |
return <String, TaskInput>{ |
- UNIT_INPUT: RESOLVED_UNIT9.of(unit), |
+ UNIT_INPUT: RESOLVED_UNIT8.of(unit), |
LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library), |
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
// In strong mode, add additional dependencies to enforce inference |
@@ -5468,14 +5156,14 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { |
// Require that static variable inference be complete for all units in |
// the current library cycle. |
'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit.library).toList( |
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( |
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT8.of( |
new LibrarySpecificUnit( |
(unit as CompilationUnitElementImpl).librarySource, |
unit.source))), |
// Require that full inference be complete for all dependencies of the |
// current library cycle. |
'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit.library).toList( |
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT11.of( |
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
new LibrarySpecificUnit( |
(unit as CompilationUnitElementImpl).librarySource, |
unit.source))) |
@@ -5493,7 +5181,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { |
} |
/** |
- * A task that finishes resolution by requesting [RESOLVED_UNIT12] for every |
+ * A task that finishes resolution by requesting [RESOLVED_UNIT11] for every |
* unit in the libraries closure and produces [LIBRARY_ELEMENT9]. |
*/ |
class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { |
@@ -5534,7 +5222,7 @@ class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { |
return <String, TaskInput>{ |
LIBRARY_INPUT: LIBRARY_ELEMENT8.of(source), |
'resolvedUnits': |
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT12), |
+ LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT11), |
}; |
} |
@@ -5549,7 +5237,7 @@ class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { |
} |
/** |
- * A task that finishes resolution by requesting [RESOLVED_UNIT13] for every |
+ * A task that finishes resolution by requesting [RESOLVED_UNIT12] for every |
* unit in the libraries closure and produces [LIBRARY_ELEMENT]. |
*/ |
class ResolveLibraryTask extends SourceBasedAnalysisTask { |
@@ -5559,7 +5247,7 @@ class ResolveLibraryTask extends SourceBasedAnalysisTask { |
static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
/** |
- * The name of the list of [RESOLVED_UNIT13] input. |
+ * The name of the list of [RESOLVED_UNIT12] input. |
*/ |
static const String UNITS_INPUT = 'UNITS_INPUT'; |
@@ -5859,7 +5547,7 @@ class ResolveUnitTask extends SourceBasedAnalysisTask { |
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
/** |
- * The name of the [RESOLVED_UNIT11] input. |
+ * The name of the [RESOLVED_UNIT10] input. |
*/ |
static const String UNIT_INPUT = 'UNIT_INPUT'; |
@@ -5867,8 +5555,8 @@ class ResolveUnitTask extends SourceBasedAnalysisTask { |
'ResolveUnitTask', createTask, buildInputs, <ResultDescriptor>[ |
CONSTANT_EXPRESSIONS_DEPENDENCIES, |
RESOLVE_UNIT_ERRORS, |
- CREATED_RESOLVED_UNIT12, |
- RESOLVED_UNIT12 |
+ CREATED_RESOLVED_UNIT11, |
+ RESOLVED_UNIT11 |
]); |
ResolveUnitTask( |
@@ -5914,8 +5602,8 @@ class ResolveUnitTask extends SourceBasedAnalysisTask { |
// |
outputs[CONSTANT_EXPRESSIONS_DEPENDENCIES] = constExprDependencies; |
outputs[RESOLVE_UNIT_ERRORS] = getTargetSourceErrors(errorListener, target); |
- outputs[RESOLVED_UNIT12] = unit; |
- outputs[CREATED_RESOLVED_UNIT12] = true; |
+ outputs[RESOLVED_UNIT11] = unit; |
+ outputs[CREATED_RESOLVED_UNIT11] = true; |
} |
/** |
@@ -5928,14 +5616,14 @@ class ResolveUnitTask extends SourceBasedAnalysisTask { |
return <String, TaskInput>{ |
LIBRARY_INPUT: LIBRARY_ELEMENT8.of(unit.library), |
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
- UNIT_INPUT: RESOLVED_UNIT11.of(unit), |
+ UNIT_INPUT: RESOLVED_UNIT10.of(unit), |
// In strong mode, add additional dependencies to enforce inference |
// ordering. |
// Require that inference be complete for all units in the |
// current library cycle. |
'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit.library).toList( |
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT11.of( |
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
new LibrarySpecificUnit( |
(unit as CompilationUnitElementImpl).librarySource, |
unit.source))) |
@@ -6290,7 +5978,7 @@ class ScanDartTask extends SourceBasedAnalysisTask { |
*/ |
class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask { |
/** |
- * The name of the [RESOLVED_UNIT13] input. |
+ * The name of the [RESOLVED_UNIT12] input. |
*/ |
static const String UNIT_INPUT = 'UNIT_INPUT'; |
@@ -6351,7 +6039,7 @@ class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask { |
static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
LibrarySpecificUnit unit = target; |
return <String, TaskInput>{ |
- UNIT_INPUT: RESOLVED_UNIT13.of(unit), |
+ UNIT_INPUT: RESOLVED_UNIT12.of(unit), |
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
}; |
} |