Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1854863002: Issue 26096. Explicitly compute the result that ensures that directives are resolved in units. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix for a review comment. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 bd548cb59485e7d5b1d05e994782e4c888f81c67..88c44fe23c9c9f09e781f032794e80c21c95ed8b 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -223,6 +223,15 @@ final ResultDescriptor<bool> CREATED_RESOLVED_UNIT11 =
new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT11', false);
/**
+ * The flag specifying that [RESOLVED_UNIT12] 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_UNIT12 =
+ new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT12', 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).
*
@@ -642,8 +651,9 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 =
cachingPolicy: AST_CACHING_POLICY);
/**
- * The resolved [CompilationUnit] associated with a compilation unit, with
- * constants not yet 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.
*/
@@ -653,7 +663,7 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT10 =
/**
* The resolved [CompilationUnit] associated with a compilation unit, with
- * constants resolved.
+ * constants not yet resolved.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -662,11 +672,20 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT11 =
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_UNIT12 =
+ new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT12', null,
+ cachingPolicy: AST_CACHING_POLICY);
+
+/**
* The partially resolved [CompilationUnit] associated with a compilation unit.
*
- * Tasks that use this value as an input can assume that the [SimpleIdentifier]s
- * at all declaration sites have been bound to the element defined by the
- * declaration, including the constants defined in an 'enum' declaration.
+ * In addition to what is true of a [RESOLVED_UNIT1], tasks that use this value
+ * as an input can assume that its directives have been resolved.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -677,10 +696,9 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 =
/**
* The partially resolved [CompilationUnit] associated with a compilation unit.
*
- * In addition to what is true of a [RESOLVED_UNIT2], tasks that use this value
- * as an input can assume that the types associated with declarations have been
- * resolved. This includes the types of superclasses, mixins, interfaces,
- * fields, return types, parameters, and local variables.
+ * Tasks that use this value as an input can assume that the [SimpleIdentifier]s
+ * at all declaration sites have been bound to the element defined by the
+ * declaration, including the constants defined in an 'enum' declaration.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -692,8 +710,9 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 =
* The partially resolved [CompilationUnit] associated with a compilation unit.
*
* In addition to what is true of a [RESOLVED_UNIT3], tasks that use this value
- * as an input can assume that references to local variables and formal
- * parameters have been resolved.
+ * as an input can assume that the types associated with declarations have been
+ * resolved. This includes the types of superclasses, mixins, interfaces,
+ * fields, return types, parameters, and local variables.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -705,9 +724,8 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 =
* The partially resolved [CompilationUnit] associated with a compilation unit.
*
* In addition to what is true of a [RESOLVED_UNIT4], tasks that use this value
- * as an input can assume that elements and types associated with expressions
- * outside of method bodies (essentially initializers) have been initially
- * resolved.
+ * as an input can assume that references to local variables and formal
+ * parameters have been resolved.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -719,8 +737,9 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 =
* The partially resolved [CompilationUnit] associated with a compilation unit.
*
* In addition to what is true of a [RESOLVED_UNIT5], 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 elements and types associated with expressions
+ * outside of method bodies (essentially initializers) have been initially
+ * resolved.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -732,7 +751,8 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 =
* The partially resolved [CompilationUnit] associated with a compilation unit.
*
* In addition to what is true of a [RESOLVED_UNIT6], 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 types of final variables have been
+ * propagated.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -744,8 +764,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 initializers of instance variables have been
- * re-resolved.
+ * as an input can assume that the types of static variables have been inferred.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -754,9 +773,11 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT8 =
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_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 initializers of instance variables have been
+ * re-resolved.
*
* The result is only available for [LibrarySpecificUnit]s.
*/
@@ -1125,7 +1146,7 @@ class BuildEnumMemberElementsTask extends SourceBasedAnalysisTask {
'BuildEnumMemberElementsTask',
createTask,
buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT2, RESOLVED_UNIT2]);
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT3, RESOLVED_UNIT3]);
BuildEnumMemberElementsTask(
InternalAnalysisContext context, AnalysisTarget target)
@@ -1160,8 +1181,8 @@ class BuildEnumMemberElementsTask extends SourceBasedAnalysisTask {
//
// Record outputs.
//
- outputs[CREATED_RESOLVED_UNIT2] = true;
- outputs[RESOLVED_UNIT2] = unit;
+ outputs[CREATED_RESOLVED_UNIT3] = true;
+ outputs[RESOLVED_UNIT3] = unit;
}
/**
@@ -1173,7 +1194,7 @@ class BuildEnumMemberElementsTask extends SourceBasedAnalysisTask {
LibrarySpecificUnit unit = target;
return <String, TaskInput>{
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- UNIT_INPUT: RESOLVED_UNIT1.of(unit)
+ UNIT_INPUT: RESOLVED_UNIT2.of(unit)
};
}
@@ -1878,7 +1899,7 @@ class ComputeConstantValueTask extends ConstantEvaluationAnalysisTask {
class ComputeInferableStaticVariableDependenciesTask
extends InferStaticVariableTask {
/**
- * The name of the [RESOLVED_UNIT5] input.
+ * The name of the [RESOLVED_UNIT6] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -1932,7 +1953,7 @@ class ComputeInferableStaticVariableDependenciesTask
CompilationUnitElementImpl unit = target
.getAncestor((Element element) => element is CompilationUnitElement);
return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT5
+ UNIT_INPUT: RESOLVED_UNIT6
.of(new LibrarySpecificUnit(unit.librarySource, unit.source))
};
}
@@ -2062,7 +2083,7 @@ class ComputeLibraryCycleTask extends SourceBasedAnalysisTask {
class ComputePropagableVariableDependenciesTask
extends InferStaticVariableTask {
/**
- * The name of the [RESOLVED_UNIT5] input.
+ * The name of the [RESOLVED_UNIT6] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -2117,7 +2138,7 @@ class ComputePropagableVariableDependenciesTask
CompilationUnitElementImpl unit = target
.getAncestor((Element element) => element is CompilationUnitElement);
return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT5
+ UNIT_INPUT: RESOLVED_UNIT6
.of(new LibrarySpecificUnit(unit.librarySource, unit.source))
};
}
@@ -2483,11 +2504,11 @@ class DartErrorsTask extends SourceBasedAnalysisTask {
}
/**
- * A task that builds [RESOLVED_UNIT11] for a unit.
+ * A task that builds [RESOLVED_UNIT12] for a unit.
*/
class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask {
/**
- * The name of the [RESOLVED_UNIT10] input.
+ * The name of the [RESOLVED_UNIT11] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -2503,7 +2524,7 @@ class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask {
'EvaluateUnitConstantsTask',
createTask,
buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT11, RESOLVED_UNIT11]);
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT12, RESOLVED_UNIT12]);
EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target)
: super(context, target);
@@ -2516,8 +2537,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_UNIT11] = unit;
- outputs[CREATED_RESOLVED_UNIT11] = true;
+ outputs[RESOLVED_UNIT12] = unit;
+ outputs[CREATED_RESOLVED_UNIT12] = true;
}
/**
@@ -2529,7 +2550,7 @@ class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask {
LibrarySpecificUnit unit = target;
return <String, TaskInput>{
'libraryElement': LIBRARY_ELEMENT8.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT10.of(unit),
+ UNIT_INPUT: RESOLVED_UNIT11.of(unit),
CONSTANT_VALUES:
COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE),
'constantExpressionsDependencies':
@@ -2552,7 +2573,7 @@ class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask {
*/
class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask {
/**
- * The name of the [RESOLVED_UNIT10] input.
+ * The name of the [RESOLVED_UNIT11] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -2596,7 +2617,7 @@ class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask {
*/
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
LibrarySpecificUnit unit = target;
- return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT10.of(unit)};
+ return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)};
}
/**
@@ -2614,7 +2635,7 @@ class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask {
*/
class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask {
/**
- * The name of the [RESOLVED_UNIT10] input.
+ * The name of the [RESOLVED_UNIT11] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -2658,7 +2679,7 @@ class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask {
*/
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
LibrarySpecificUnit unit = target;
- return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT10.of(unit)};
+ return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)};
}
/**
@@ -2676,7 +2697,7 @@ class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask {
*/
class GenerateHintsTask extends SourceBasedAnalysisTask {
/**
- * The name of the [RESOLVED_UNIT10] input.
+ * The name of the [RESOLVED_UNIT11] input.
*/
static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT';
@@ -2895,7 +2916,7 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask {
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
/**
- * The name of the input whose value is the [RESOLVED_UNIT7] for the
+ * The name of the input whose value is the [RESOLVED_UNIT8] for the
* compilation unit.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -2907,7 +2928,7 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask {
'InferInstanceMembersInUnitTask',
createTask,
buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT9, RESOLVED_UNIT9]);
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT10, RESOLVED_UNIT10]);
/**
* Initialize a newly created task to build a library element for the given
@@ -2939,8 +2960,8 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask {
//
// Record outputs.
//
- outputs[RESOLVED_UNIT9] = unit;
- outputs[CREATED_RESOLVED_UNIT9] = true;
+ outputs[RESOLVED_UNIT10] = unit;
+ outputs[CREATED_RESOLVED_UNIT10] = true;
}
/**
@@ -2951,7 +2972,7 @@ class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask {
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
LibrarySpecificUnit unit = target;
return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT8.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.
@@ -2959,14 +2980,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).toList(
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT8.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).toList(
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of(
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of(
new LibrarySpecificUnit(
(unit as CompilationUnitElementImpl).librarySource,
unit.source)))
@@ -3037,7 +3058,7 @@ abstract class InferStaticVariableTask extends ConstantEvaluationAnalysisTask {
*/
class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask {
/**
- * The name of the input whose value is the [RESOLVED_UNIT6] for the
+ * The name of the input whose value is the [RESOLVED_UNIT7] for the
* compilation unit.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -3055,7 +3076,7 @@ class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask {
'InferStaticVariableTypesInUnitTask',
createTask,
buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT7, RESOLVED_UNIT7]);
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT8, RESOLVED_UNIT8]);
/**
* Initialize a newly created task to build a library element for the given
@@ -3079,8 +3100,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_UNIT7] = unit;
- outputs[CREATED_RESOLVED_UNIT7] = true;
+ outputs[RESOLVED_UNIT8] = unit;
+ outputs[CREATED_RESOLVED_UNIT8] = true;
}
/**
@@ -3094,7 +3115,7 @@ class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask {
INFERRED_VARIABLES_INPUT: INFERABLE_STATIC_VARIABLES_IN_UNIT
.of(unit)
.toListOf(INFERRED_STATIC_VARIABLE),
- UNIT_INPUT: RESOLVED_UNIT6.of(unit)
+ UNIT_INPUT: RESOLVED_UNIT7.of(unit)
};
}
@@ -3125,7 +3146,7 @@ class InferStaticVariableTypeTask extends InferStaticVariableTask {
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
/**
- * The name of the [RESOLVED_UNIT6] input.
+ * The name of the [RESOLVED_UNIT7] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -3216,14 +3237,14 @@ class InferStaticVariableTypeTask extends InferStaticVariableTask {
.of(variable)
.toListOf(INFERRED_STATIC_VARIABLE),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- UNIT_INPUT: RESOLVED_UNIT6.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).toList(
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of(
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of(
new LibrarySpecificUnit(
(unit as CompilationUnitElementImpl).librarySource,
unit.source)))
@@ -3623,7 +3644,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
}
/**
- * A task that builds [RESOLVED_UNIT5] for a unit.
+ * A task that builds [RESOLVED_UNIT6] for a unit.
*/
class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask {
/**
@@ -3632,7 +3653,7 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask {
static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
/**
- * The name of the [RESOLVED_UNIT4] input.
+ * The name of the [RESOLVED_UNIT5] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -3650,8 +3671,8 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask {
buildInputs, <ResultDescriptor>[
INFERABLE_STATIC_VARIABLES_IN_UNIT,
PROPAGABLE_VARIABLES_IN_UNIT,
- CREATED_RESOLVED_UNIT5,
- RESOLVED_UNIT5
+ CREATED_RESOLVED_UNIT6,
+ RESOLVED_UNIT6
]);
PartiallyResolveUnitReferencesTask(
@@ -3685,8 +3706,8 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask {
outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = VariableElement.EMPTY_LIST;
}
outputs[PROPAGABLE_VARIABLES_IN_UNIT] = visitor.propagableVariables;
- outputs[RESOLVED_UNIT5] = unit;
- outputs[CREATED_RESOLVED_UNIT5] = true;
+ outputs[RESOLVED_UNIT6] = unit;
+ outputs[CREATED_RESOLVED_UNIT6] = true;
}
/**
@@ -3699,7 +3720,7 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask {
return <String, TaskInput>{
'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library),
LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT4.of(unit),
+ UNIT_INPUT: RESOLVED_UNIT5.of(unit),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
// In strong mode, add additional dependencies to enforce inference
// ordering.
@@ -3707,7 +3728,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).toList(
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of(
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of(
new LibrarySpecificUnit(
(unit as CompilationUnitElementImpl).librarySource,
unit.source)))
@@ -3821,7 +3842,7 @@ class PropagateVariableTypesInLibraryTask extends SourceBasedAnalysisTask {
Source source = target;
return <String, TaskInput>{
'propagatedVariableTypesInUnits':
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT6),
+ LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT7),
LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source),
};
}
@@ -3842,7 +3863,7 @@ class PropagateVariableTypesInLibraryTask extends SourceBasedAnalysisTask {
*/
class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask {
/**
- * The name of the input whose value is the [RESOLVED_UNIT5] for the
+ * The name of the input whose value is the [RESOLVED_UNIT6] for the
* compilation unit.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -3854,7 +3875,7 @@ class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask {
'PropagateVariableTypesInUnitTask',
createTask,
buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT6, RESOLVED_UNIT6]);
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT7, RESOLVED_UNIT7]);
PropagateVariableTypesInUnitTask(
InternalAnalysisContext context, LibrarySpecificUnit unit)
@@ -3874,8 +3895,8 @@ class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask {
// because the work has implicitly been done by virtue of the task model
// preparing all of the inputs.
//
- outputs[RESOLVED_UNIT6] = unit;
- outputs[CREATED_RESOLVED_UNIT6] = true;
+ outputs[RESOLVED_UNIT7] = unit;
+ outputs[CREATED_RESOLVED_UNIT7] = true;
}
/**
@@ -3888,7 +3909,7 @@ class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask {
return <String, TaskInput>{
'variables':
PROPAGABLE_VARIABLES_IN_UNIT.of(unit).toListOf(PROPAGATED_VARIABLE),
- UNIT_INPUT: RESOLVED_UNIT5.of(unit)
+ UNIT_INPUT: RESOLVED_UNIT6.of(unit)
};
}
@@ -3913,7 +3934,7 @@ class PropagateVariableTypeTask extends InferStaticVariableTask {
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
/**
- * The name of the [RESOLVED_UNIT5] input.
+ * The name of the [RESOLVED_UNIT6] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -3999,7 +4020,7 @@ class PropagateVariableTypeTask extends InferStaticVariableTask {
.of(variable)
.toListOf(PROPAGATED_VARIABLE),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- UNIT_INPUT: RESOLVED_UNIT5.of(unit),
+ UNIT_INPUT: RESOLVED_UNIT6.of(unit),
};
}
@@ -4323,7 +4344,7 @@ class ResolveConstantExpressionTask extends ConstantEvaluationAnalysisTask {
'Cannot build inputs for a ${target.runtimeType}');
}
return <String, TaskInput>{
- 'createdResolvedUnit': CREATED_RESOLVED_UNIT10
+ 'createdResolvedUnit': CREATED_RESOLVED_UNIT11
.of(new LibrarySpecificUnit(librarySource, target.source))
};
}
@@ -4339,6 +4360,80 @@ class ResolveConstantExpressionTask extends ConstantEvaluationAnalysisTask {
}
/**
+ * A task that resolves imports and export directives to already built elements.
+ */
+class ResolveDirectiveElementsTask extends SourceBasedAnalysisTask {
+ /**
+ * The name of the input whose value is the defining [LIBRARY_ELEMENT2].
+ */
+ static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
+
+ /**
+ * The name of the input for [RESOLVED_UNIT1] of a unit.
+ */
+ static const String UNIT_INPUT = 'UNIT_INPUT';
+
+ /**
+ * The task descriptor describing this kind of task.
+ */
+ static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
+ 'ResolveDirectiveElementsTask',
+ createTask,
+ buildInputs,
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT2, RESOLVED_UNIT2]);
+
+ ResolveDirectiveElementsTask(
+ InternalAnalysisContext context, AnalysisTarget target)
+ : super(context, target);
+
+ @override
+ TaskDescriptor get descriptor => DESCRIPTOR;
+
+ @override
+ void internalPerform() {
+ LibrarySpecificUnit targetUnit = target;
+ //
+ // Prepare inputs.
+ //
+ CompilationUnit unit = getRequiredInput(UNIT_INPUT);
+ //
+ // Resolve directive AST nodes to elements.
+ //
+ if (targetUnit.unit == targetUnit.library) {
+ DirectiveResolver resolver = new DirectiveResolver();
+ unit.accept(resolver);
+ }
+ //
+ // Record outputs.
+ //
+ outputs[CREATED_RESOLVED_UNIT2] = true;
+ outputs[RESOLVED_UNIT2] = unit;
+ }
+
+ /**
+ * 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>{
+ LIBRARY_INPUT: LIBRARY_ELEMENT2.of(unit.library),
+ UNIT_INPUT: RESOLVED_UNIT1.of(unit)
+ };
+ }
+
+ /**
+ * Create a [ResolveDirectiveElementsTask] based on the given [target] in
+ * the given [context].
+ */
+ static ResolveDirectiveElementsTask createTask(
+ AnalysisContext context, AnalysisTarget target) {
+ return new ResolveDirectiveElementsTask(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
*/
@@ -4354,7 +4449,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask {
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
/**
- * The name of the input whose value is the [RESOLVED_UNIT7] for the
+ * The name of the input whose value is the [RESOLVED_UNIT8] for the
* compilation unit.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -4366,7 +4461,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask {
'ResolveInstanceFieldsInUnitTask',
createTask,
buildInputs,
- <ResultDescriptor>[CREATED_RESOLVED_UNIT8, RESOLVED_UNIT8]);
+ <ResultDescriptor>[CREATED_RESOLVED_UNIT9, RESOLVED_UNIT9]);
/**
* Initialize a newly created task to build a library element for the given
@@ -4411,8 +4506,8 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask {
//
// Record outputs.
//
- outputs[RESOLVED_UNIT8] = unit;
- outputs[CREATED_RESOLVED_UNIT8] = true;
+ outputs[RESOLVED_UNIT9] = unit;
+ outputs[CREATED_RESOLVED_UNIT9] = true;
}
/**
@@ -4423,7 +4518,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask {
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
LibrarySpecificUnit unit = target;
return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT7.of(unit),
+ UNIT_INPUT: RESOLVED_UNIT8.of(unit),
LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
// In strong mode, add additional dependencies to enforce inference
@@ -4432,14 +4527,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).toList(
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT7.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).toList(
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of(
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of(
new LibrarySpecificUnit(
(unit as CompilationUnitElementImpl).librarySource,
unit.source)))
@@ -4457,7 +4552,7 @@ class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask {
}
/**
- * A task that finishes resolution by requesting [RESOLVED_UNIT10] for every
+ * A task that finishes resolution by requesting [RESOLVED_UNIT11] for every
* unit in the libraries closure and produces [LIBRARY_ELEMENT8].
*/
class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask {
@@ -4467,7 +4562,7 @@ class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask {
static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
/**
- * The name of the list of [RESOLVED_UNIT10] input.
+ * The name of the list of [RESOLVED_UNIT11] input.
*/
static const String UNITS_INPUT = 'UNITS_INPUT';
@@ -4515,7 +4610,7 @@ class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask {
Source source = target;
return <String, TaskInput>{
LIBRARY_INPUT: LIBRARY_ELEMENT7.of(source),
- UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT10),
+ UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT11),
};
}
@@ -4530,7 +4625,7 @@ class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask {
}
/**
- * A task that finishes resolution by requesting [RESOLVED_UNIT11] 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 {
@@ -4540,7 +4635,7 @@ class ResolveLibraryTask extends SourceBasedAnalysisTask {
static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
/**
- * The name of the list of [RESOLVED_UNIT11] input.
+ * The name of the list of [RESOLVED_UNIT12] input.
*/
static const String UNITS_INPUT = 'UNITS_INPUT';
@@ -4651,7 +4746,7 @@ class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask {
Source source = target;
return <String, TaskInput>{
'resolvedUnit':
- LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT3),
+ LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT4),
LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
@@ -4683,7 +4778,7 @@ class ResolveUnitTask extends SourceBasedAnalysisTask {
static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
/**
- * The name of the [RESOLVED_UNIT9] input.
+ * The name of the [RESOLVED_UNIT10] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -4691,8 +4786,8 @@ class ResolveUnitTask extends SourceBasedAnalysisTask {
'ResolveUnitTask', createTask, buildInputs, <ResultDescriptor>[
CONSTANT_EXPRESSIONS_DEPENDENCIES,
RESOLVE_UNIT_ERRORS,
- CREATED_RESOLVED_UNIT10,
- RESOLVED_UNIT10
+ CREATED_RESOLVED_UNIT11,
+ RESOLVED_UNIT11
]);
ResolveUnitTask(
@@ -4738,8 +4833,8 @@ class ResolveUnitTask extends SourceBasedAnalysisTask {
//
outputs[CONSTANT_EXPRESSIONS_DEPENDENCIES] = constExprDependencies;
outputs[RESOLVE_UNIT_ERRORS] = getTargetSourceErrors(errorListener, target);
- outputs[RESOLVED_UNIT10] = unit;
- outputs[CREATED_RESOLVED_UNIT10] = true;
+ outputs[RESOLVED_UNIT11] = unit;
+ outputs[CREATED_RESOLVED_UNIT11] = true;
}
/**
@@ -4752,14 +4847,14 @@ class ResolveUnitTask extends SourceBasedAnalysisTask {
return <String, TaskInput>{
LIBRARY_INPUT: LIBRARY_ELEMENT7.of(unit.library),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
- UNIT_INPUT: RESOLVED_UNIT9.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).toList(
- (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of(
+ (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of(
new LibrarySpecificUnit(
(unit as CompilationUnitElementImpl).librarySource,
unit.source)))
@@ -4777,7 +4872,7 @@ class ResolveUnitTask extends SourceBasedAnalysisTask {
}
/**
- * A task that builds [RESOLVED_UNIT3] for a unit.
+ * A task that builds [RESOLVED_UNIT4] for a unit.
*/
class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
/**
@@ -4786,7 +4881,7 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
/**
- * The name of the [RESOLVED_UNIT2] input.
+ * The name of the [RESOLVED_UNIT3] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -4801,8 +4896,8 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[
RESOLVE_TYPE_NAMES_ERRORS,
- CREATED_RESOLVED_UNIT3,
- RESOLVED_UNIT3
+ CREATED_RESOLVED_UNIT4,
+ RESOLVED_UNIT4
]);
ResolveUnitTypeNamesTask(
@@ -4833,8 +4928,8 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
//
outputs[RESOLVE_TYPE_NAMES_ERRORS] =
getTargetSourceErrors(errorListener, target);
- outputs[RESOLVED_UNIT3] = unit;
- outputs[CREATED_RESOLVED_UNIT3] = true;
+ outputs[RESOLVED_UNIT4] = unit;
+ outputs[CREATED_RESOLVED_UNIT4] = true;
}
/**
@@ -4851,7 +4946,7 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
'importsExportNamespace':
IMPORTED_LIBRARIES.of(unit.library).toMapOf(LIBRARY_ELEMENT4),
LIBRARY_INPUT: LIBRARY_ELEMENT4.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT2.of(unit),
+ UNIT_INPUT: RESOLVED_UNIT3.of(unit),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
}
@@ -4867,7 +4962,7 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
}
/**
- * A task that builds [RESOLVED_UNIT4] for a unit.
+ * A task that builds [RESOLVED_UNIT5] for a unit.
*/
class ResolveVariableReferencesTask extends SourceBasedAnalysisTask {
/**
@@ -4876,7 +4971,7 @@ class ResolveVariableReferencesTask extends SourceBasedAnalysisTask {
static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
/**
- * The name of the [RESOLVED_UNIT3] input.
+ * The name of the [RESOLVED_UNIT4] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -4892,8 +4987,8 @@ class ResolveVariableReferencesTask extends SourceBasedAnalysisTask {
'ResolveVariableReferencesTask',
createTask,
buildInputs, <ResultDescriptor>[
- CREATED_RESOLVED_UNIT4,
- RESOLVED_UNIT4,
+ CREATED_RESOLVED_UNIT5,
+ RESOLVED_UNIT5,
VARIABLE_REFERENCE_ERRORS
]);
@@ -4925,8 +5020,8 @@ class ResolveVariableReferencesTask extends SourceBasedAnalysisTask {
//
// Record outputs.
//
- outputs[RESOLVED_UNIT4] = unit;
- outputs[CREATED_RESOLVED_UNIT4] = true;
+ outputs[RESOLVED_UNIT5] = unit;
+ outputs[CREATED_RESOLVED_UNIT5] = true;
outputs[VARIABLE_REFERENCE_ERRORS] =
getTargetSourceErrors(errorListener, target);
}
@@ -4940,7 +5035,7 @@ class ResolveVariableReferencesTask extends SourceBasedAnalysisTask {
LibrarySpecificUnit unit = target;
return <String, TaskInput>{
LIBRARY_INPUT: LIBRARY_ELEMENT1.of(unit.library),
- UNIT_INPUT: RESOLVED_UNIT3.of(unit),
+ UNIT_INPUT: RESOLVED_UNIT4.of(unit),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
}
@@ -5092,7 +5187,7 @@ class ScanDartTask extends SourceBasedAnalysisTask {
*/
class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask {
/**
- * The name of the [RESOLVED_UNIT11] input.
+ * The name of the [RESOLVED_UNIT12] input.
*/
static const String UNIT_INPUT = 'UNIT_INPUT';
@@ -5148,7 +5243,7 @@ class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask {
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
LibrarySpecificUnit unit = target;
return <String, TaskInput>{
- UNIT_INPUT: RESOLVED_UNIT11.of(unit),
+ UNIT_INPUT: RESOLVED_UNIT12.of(unit),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
};
}

Powered by Google App Engine
This is Rietveld 408576698