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

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

Issue 1422793002: Use LIBRARY_SPECIFIC_UNITS instead of UNITS. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/inputs.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33a4c6f5e13ea4647f2fa13b25f95dd556e39e19..4845e7353443131354be1377a3d68e51e0317a2e 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -162,6 +162,17 @@ final ListResultDescriptor<Source> IMPORT_EXPORT_SOURCE_CLOSURE =
new ListResultDescriptor<Source>('IMPORT_EXPORT_SOURCE_CLOSURE', null);
/**
+ * The sources representing [LibrarySpecificUnit]s for all of the [UNITS] of
+ * the combined import/export closure of a library.
+ *
+ * The result is only available for [Source]s representing a library.
+ */
+final ListResultDescriptor<
+ LibrarySpecificUnit> IMPORT_EXPORT_SOURCE_CLOSURE_UNITS =
Brian Wilkerson 2015/10/23 13:58:57 This doesn't appear to be used anywhere (that I ca
+ new ListResultDescriptor<LibrarySpecificUnit>(
+ 'IMPORT_EXPORT_SOURCE_CLOSURE_UNITS', LibrarySpecificUnit.EMPTY_LIST);
+
+/**
* A list of the [VariableElement]s whose type should be inferred that another
* inferable static variable (the target) depends on.
*
@@ -304,6 +315,18 @@ final ResultDescriptor<bool> LIBRARY_ERRORS_READY =
new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false);
/**
+ * The [LibrarySpecificUnit]s that a library consists of.
+ *
+ * The list will include the defining unit and units for [INCLUDED_PARTS].
+ * So, it is never empty or `null`.
+ *
+ * The result is only available for [Source]s representing a library.
+ */
+final ListResultDescriptor<LibrarySpecificUnit> LIBRARY_SPECIFIC_UNITS =
+ new ListResultDescriptor<LibrarySpecificUnit>(
+ 'LIBRARY_SPECIFIC_UNITS', LibrarySpecificUnit.EMPTY_LIST);
+
+/**
* The analysis errors associated with a compilation unit in a specific library.
*
* The result is only available for [LibrarySpecificUnit]s.
@@ -1466,7 +1489,7 @@ class BuildSourceImportExportClosureTask extends SourceBasedAnalysisTask {
/**
* 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 library [libSource].
+ * given library [target].
*/
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
Source source = target;
@@ -1614,16 +1637,18 @@ class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask {
Source librarySource = unit.librarySource;
return <String, TaskInput>{
'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE.of(librarySource).toList(
- (Source library) => UNITS.of(library).toList((Source source) =>
- RESOLVED_UNIT9.of(new LibrarySpecificUnit(library, source)))),
+ (Source library) => LIBRARY_SPECIFIC_UNITS
+ .of(library)
+ .toList((LibrarySpecificUnit unit) => RESOLVED_UNIT9.of(unit))),
Brian Wilkerson 2015/10/23 13:58:57 Note that this is the code that will be reverted,
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
} else if (target is ConstantEvaluationTarget_Annotation) {
Source librarySource = target.librarySource;
return <String, TaskInput>{
'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE.of(librarySource).toList(
- (Source library) => UNITS.of(library).toList((Source source) =>
- RESOLVED_UNIT9.of(new LibrarySpecificUnit(library, source)))),
+ (Source library) => LIBRARY_SPECIFIC_UNITS
+ .of(library)
+ .toList((LibrarySpecificUnit unit) => RESOLVED_UNIT9.of(unit))),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
}
@@ -2582,14 +2607,10 @@ class GenerateHintsTask extends SourceBasedAnalysisTask {
Source libSource = unit.library;
return <String, TaskInput>{
RESOLVED_UNIT_INPUT: RESOLVED_UNIT.of(unit),
- USED_LOCAL_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) {
- LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit);
- return USED_LOCAL_ELEMENTS.of(target);
- }),
- USED_IMPORTED_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) {
- LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit);
- return USED_IMPORTED_ELEMENTS.of(target);
- }),
+ USED_LOCAL_ELEMENTS_INPUT:
+ LIBRARY_SPECIFIC_UNITS.of(libSource).toListOf(USED_LOCAL_ELEMENTS),
+ USED_IMPORTED_ELEMENTS_INPUT:
+ LIBRARY_SPECIFIC_UNITS.of(libSource).toListOf(USED_IMPORTED_ELEMENTS),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
}
@@ -3036,7 +3057,7 @@ class LibraryErrorsReadyTask extends SourceBasedAnalysisTask {
/**
* 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 [library].
+ * given [target].
*/
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
Source source = target;
@@ -3215,6 +3236,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
EXPORTED_LIBRARIES,
IMPORTED_LIBRARIES,
INCLUDED_PARTS,
+ LIBRARY_SPECIFIC_UNITS,
PARSE_ERRORS,
PARSED_UNIT,
SOURCE_KIND,
@@ -3301,10 +3323,13 @@ class ParseDartTask extends SourceBasedAnalysisTask {
List<AnalysisError> parseErrors =
removeDuplicateErrors(errorListener.errors);
List<Source> unitSources = <Source>[source]..addAll(includedSourceSet);
+ List<LibrarySpecificUnit> librarySpecificUnits =
+ unitSources.map((s) => new LibrarySpecificUnit(source, s)).toList();
outputs[EXPLICITLY_IMPORTED_LIBRARIES] = explicitlyImportedSources;
outputs[EXPORTED_LIBRARIES] = exportedSources;
outputs[IMPORTED_LIBRARIES] = importedSources;
outputs[INCLUDED_PARTS] = includedSources;
+ outputs[LIBRARY_SPECIFIC_UNITS] = librarySpecificUnits;
outputs[PARSE_ERRORS] = parseErrors;
outputs[PARSED_UNIT] = unit;
outputs[SOURCE_KIND] = sourceKind;
@@ -3785,13 +3810,11 @@ class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask {
Source source = target;
return <String, TaskInput>{
LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source),
- UNITS_INPUT: UNITS.of(source).toList((Source unit) =>
- RESOLVED_UNIT9.of(new LibrarySpecificUnit(source, unit))),
+ UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT9),
'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE
.of(source)
- .toMapOf(UNITS)
- .toFlattenList((Source library, Source unit) =>
- RESOLVED_UNIT9.of(new LibrarySpecificUnit(library, unit))),
+ .toFlattenListOf(LIBRARY_SPECIFIC_UNITS)
+ .toListOf(RESOLVED_UNIT9),
};
}
@@ -3861,8 +3884,8 @@ class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask {
static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
Source source = target;
return <String, TaskInput>{
- 'resolvedUnit': UNITS.of(source).toList((Source unit) =>
- RESOLVED_UNIT3.of(new LibrarySpecificUnit(source, unit))),
+ 'resolvedUnit':
+ LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT3),
LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
@@ -4316,9 +4339,8 @@ class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask {
return <String, TaskInput>{
'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE
.of(unit.library)
- .toMapOf(UNITS)
- .toFlattenList((Source library, Source unit) =>
- RESOLVED_UNIT10.of(new LibrarySpecificUnit(library, unit))),
+ .toFlattenListOf(LIBRARY_SPECIFIC_UNITS)
+ .toListOf(RESOLVED_UNIT10),
UNIT_INPUT: RESOLVED_UNIT10.of(unit),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
@@ -4447,9 +4469,8 @@ class VerifyUnitTask extends SourceBasedAnalysisTask {
return <String, TaskInput>{
'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE
.of(unit.library)
- .toMapOf(UNITS)
- .toFlattenList((Source library, Source unit) =>
- RESOLVED_UNIT.of(new LibrarySpecificUnit(library, unit))),
+ .toFlattenListOf(LIBRARY_SPECIFIC_UNITS)
+ .toListOf(RESOLVED_UNIT),
UNIT_INPUT: RESOLVED_UNIT.of(unit),
TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
};
@@ -4485,6 +4506,12 @@ class _ExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> {
}
/**
+ * The lists of library source that are imported or exported directly or
+ * indirectly by a [Source].
+ */
+class _ImportExportClosure {}
+
+/**
* A [TaskInput] whose value is a list of library sources imported or exported,
* directly or indirectly by the target [Source].
*
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/inputs.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698