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 71a1957083958a9e83a249fcd4608caebf551a3e..6ed3964aa3726b305d06e98cd728794f3e010a8d 100644 |
--- a/pkg/analyzer/lib/src/task/dart.dart |
+++ b/pkg/analyzer/lib/src/task/dart.dart |
@@ -365,9 +365,11 @@ final ListResultDescriptor<AnalysisError> RESOLVE_TYPE_NAMES_ERRORS = |
'RESOLVE_TYPE_NAMES_ERRORS', AnalysisError.NO_ERRORS); |
/** |
- * The partially resolved [CompilationUnit] associated with a unit. |
+ * The partially resolved [CompilationUnit] associated with a compilation unit. |
* |
- * All declarations bound to the element defined by the declaration. |
+ * 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, except for the constants defined in an 'enum' declaration. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -376,9 +378,11 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = |
cachingPolicy: AST_CACHING_POLICY); |
/** |
- * The partially resolved [CompilationUnit] associated with a unit. |
+ * The partially resolved [CompilationUnit] associated with a compilation unit. |
* |
- * All the enum member elements are built. |
+ * 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 for the constants defined in an 'enum' declaration. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -387,9 +391,12 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = |
cachingPolicy: AST_CACHING_POLICY); |
/** |
- * The partially resolved [CompilationUnit] associated with a unit. |
+ * The partially resolved [CompilationUnit] associated with a compilation unit. |
* |
- * [RESOLVED_UNIT2] with resolved type names. |
+ * 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. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -398,9 +405,11 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 = |
cachingPolicy: AST_CACHING_POLICY); |
/** |
- * The partially resolved [CompilationUnit] associated with a unit. |
+ * The partially resolved [CompilationUnit] associated with a compilation unit. |
* |
- * [RESOLVED_UNIT3] plus resolved local variables and formal parameters. |
+ * 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. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -409,9 +418,11 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 = |
cachingPolicy: AST_CACHING_POLICY); |
/** |
- * The resolved [CompilationUnit] associated with a compilation unit in which |
- * elements and types have been initially resolved outside of method bodies in |
- * addition to everything that is true of a [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 have been initially resolved |
+ * outside of method bodies. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -420,9 +431,10 @@ final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = |
cachingPolicy: AST_CACHING_POLICY); |
/** |
- * The resolved [CompilationUnit] associated with a compilation unit in which |
- * the types of static variables have been inferred in addition to everything |
- * that is true of a [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 static variables have been inferred. |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
@@ -3252,7 +3264,9 @@ class LibraryUnitErrorsTask extends SourceBasedAnalysisTask { |
} |
/** |
- * A task that parses the content of a Dart file, producing an AST structure. |
+ * A task that parses the content of a Dart file, producing an AST structure, |
+ * any lexical errors found in the process, the kind of the file (library or |
+ * part), and several lists based on the AST. |
*/ |
class ParseDartTask extends SourceBasedAnalysisTask { |
/** |
@@ -3483,10 +3497,10 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
CompilationUnitElement unitElement = unit.element; |
TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
+ // |
+ // Resolve references and record outputs. |
+ // |
if (context.analysisOptions.strongMode) { |
- // |
- // Resolve references. |
- // |
InheritanceManager inheritanceManager = |
new InheritanceManager(libraryElement); |
PartialResolverVisitor visitor = new PartialResolverVisitor( |
@@ -3496,9 +3510,7 @@ class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
AnalysisErrorListener.NULL_LISTENER, |
inheritanceManager: inheritanceManager); |
unit.accept(visitor); |
- // |
- // Record outputs. |
- // |
+ |
outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.variablesAndFields; |
} else { |
outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = []; |
@@ -3938,7 +3950,6 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { |
@override |
void internalPerform() { |
- RecordingErrorListener errorListener = new RecordingErrorListener(); |
// |
// Prepare inputs. |
// |
@@ -3949,6 +3960,7 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { |
// |
// Resolve TypeName nodes. |
// |
+ RecordingErrorListener errorListener = new RecordingErrorListener(); |
TypeResolverVisitor visitor = new TypeResolverVisitor( |
library, unitElement.source, typeProvider, errorListener); |
unit.accept(visitor); |
@@ -3966,6 +3978,9 @@ class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { |
* given [target]. |
*/ |
static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
+ // TODO(brianwilkerson) This task updates the element model to have type |
+ // information and updates the class hierarchy. It should produce a new |
+ // version of the element model in order to record those changes. |
LibrarySpecificUnit unit = target; |
return <String, TaskInput>{ |
'importsExportNamespace': |
@@ -4023,19 +4038,19 @@ class ResolveVariableReferencesTask extends SourceBasedAnalysisTask { |
@override |
void internalPerform() { |
- RecordingErrorListener errorListener = new RecordingErrorListener(); |
// |
// Prepare inputs. |
// |
LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT); |
CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
CompilationUnitElement unitElement = unit.element; |
+ TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
// |
// Resolve local variables. |
// |
- TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); |
+ RecordingErrorListener errorListener = new RecordingErrorListener(); |
Scope nameScope = new LibraryScope(libraryElement, errorListener); |
- AstVisitor visitor = new VariableResolverVisitor( |
+ VariableResolverVisitor visitor = new VariableResolverVisitor( |
libraryElement, unitElement.source, typeProvider, errorListener, |
nameScope: nameScope); |
unit.accept(visitor); |
@@ -4072,7 +4087,8 @@ class ResolveVariableReferencesTask extends SourceBasedAnalysisTask { |
} |
/** |
- * A task that scans the content of a file, producing a set of Dart tokens. |
+ * A task that scans the content of a Dart file, producing a stream of Dart |
+ * tokens, line information, and any lexical errors encountered in the process. |
*/ |
class ScanDartTask extends SourceBasedAnalysisTask { |
/** |