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

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

Issue 2298493002: Make LIBRARY_CYCLE_UNITS and LIBRARY_CYCLE_DEPENDENCIES be List<LibrarySpecificUnit>. (Closed)
Patch Set: Created 4 years, 4 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/test/src/task/dart_test.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 cb5791c51cee09960597d71cbdb7f476a1cbe623..2a464756b2b5d2286389f780cc9245a16e5a8940 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -417,7 +417,7 @@ final ListResultDescriptor<LibraryElement> LIBRARY_CYCLE =
new ListResultDescriptor<LibraryElement>('LIBRARY_CYCLE', null);
/**
- * A list of the [CompilationUnitElement]s that comprise all of the parts and
+ * A list of the [LibrarySpecificUnit]s that comprise all of the parts and
* libraries in the direct import/export dependencies of the library cycle
* of the target, with the intra-component dependencies excluded.
*
@@ -425,12 +425,12 @@ final ListResultDescriptor<LibraryElement> LIBRARY_CYCLE =
*
* The result is only available for [Source]s representing a library.
*/
-final ListResultDescriptor<CompilationUnitElement> LIBRARY_CYCLE_DEPENDENCIES =
- new ListResultDescriptor<CompilationUnitElement>(
+final ListResultDescriptor<LibrarySpecificUnit> LIBRARY_CYCLE_DEPENDENCIES =
+ new ListResultDescriptor<LibrarySpecificUnit>(
'LIBRARY_CYCLE_DEPENDENCIES', null);
/**
- * A list of the [CompilationUnitElement]s (including all parts) that make up
+ * A list of the [LibrarySpecificUnit]s (including all parts) that make up
* the strongly connected component in the import/export graph in which the
* target resides.
*
@@ -438,9 +438,8 @@ final ListResultDescriptor<CompilationUnitElement> LIBRARY_CYCLE_DEPENDENCIES =
*
* The result is only available for [Source]s representing a library.
*/
-final ListResultDescriptor<CompilationUnitElement> LIBRARY_CYCLE_UNITS =
- new ListResultDescriptor<CompilationUnitElement>(
- 'LIBRARY_CYCLE_UNITS', null);
+final ListResultDescriptor<LibrarySpecificUnit> LIBRARY_CYCLE_UNITS =
+ new ListResultDescriptor<LibrarySpecificUnit>('LIBRARY_CYCLE_UNITS', null);
/**
* The partial [LibraryElement] associated with a library.
@@ -2199,7 +2198,7 @@ class ComputeLibraryCycleTask extends SourceBasedAnalysisTask {
if (context.analysisOptions.strongMode) {
LibraryElement library = getRequiredInput(LIBRARY_ELEMENT_INPUT);
List<LibraryElement> component = library.libraryCycle;
- Set<LibraryElement> filter = new Set<LibraryElement>.from(component);
+ Set<LibraryElement> filter = component.toSet();
Set<CompilationUnitElement> deps = new Set<CompilationUnitElement>();
void addLibrary(LibraryElement l) {
if (!filter.contains(l)) {
@@ -2216,9 +2215,12 @@ class ComputeLibraryCycleTask extends SourceBasedAnalysisTask {
//
// Record outputs.
//
+ LibrarySpecificUnit unitToLSU(CompilationUnitElement unit) =>
+ new LibrarySpecificUnit(unit.librarySource, unit.source);
outputs[LIBRARY_CYCLE] = component;
- outputs[LIBRARY_CYCLE_UNITS] = component.expand((l) => l.units).toList();
- outputs[LIBRARY_CYCLE_DEPENDENCIES] = deps.toList();
+ outputs[LIBRARY_CYCLE_UNITS] =
+ component.expand((l) => l.units).map(unitToLSU).toList();
+ outputs[LIBRARY_CYCLE_DEPENDENCIES] = deps.map(unitToLSU).toList();
} else {
outputs[LIBRARY_CYCLE] = [];
outputs[LIBRARY_CYCLE_UNITS] = [];
@@ -3428,18 +3430,13 @@ 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_UNIT9.of(
- new LibrarySpecificUnit(
- (unit as CompilationUnitElementImpl).librarySource,
- unit.source))),
+ 'orderLibraryCycleTasks':
+ LIBRARY_CYCLE_UNITS.of(unit.library).toListOf(CREATED_RESOLVED_UNIT9),
// 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_UNIT10.of(
- new LibrarySpecificUnit(
- (unit as CompilationUnitElementImpl).librarySource,
- unit.source)))
+ 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
+ .of(unit.library)
+ .toListOf(CREATED_RESOLVED_UNIT10)
};
}
@@ -3722,11 +3719,9 @@ class InferStaticVariableTypeTask extends InferStaticVariableTask {
// 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_UNIT10.of(
- new LibrarySpecificUnit(
- (unit as CompilationUnitElementImpl).librarySource,
- unit.source)))
+ 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
+ .of(unit.library)
+ .toListOf(CREATED_RESOLVED_UNIT10)
};
}
@@ -4238,11 +4233,9 @@ 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_UNIT10.of(
- new LibrarySpecificUnit(
- (unit as CompilationUnitElementImpl).librarySource,
- unit.source)))
+ 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
+ .of(unit.library)
+ .toListOf(CREATED_RESOLVED_UNIT10)
};
}
@@ -5155,18 +5148,13 @@ 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_UNIT8.of(
- new LibrarySpecificUnit(
- (unit as CompilationUnitElementImpl).librarySource,
- unit.source))),
+ 'orderLibraryCycleTasks':
+ LIBRARY_CYCLE_UNITS.of(unit.library).toListOf(CREATED_RESOLVED_UNIT8),
// 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_UNIT10.of(
- new LibrarySpecificUnit(
- (unit as CompilationUnitElementImpl).librarySource,
- unit.source)))
+ 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES
+ .of(unit.library)
+ .toListOf(CREATED_RESOLVED_UNIT10)
};
}
@@ -5622,11 +5610,8 @@ class ResolveUnitTask extends SourceBasedAnalysisTask {
// 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_UNIT10.of(
- new LibrarySpecificUnit(
- (unit as CompilationUnitElementImpl).librarySource,
- unit.source)))
+ 'orderLibraryCycleTasks':
+ LIBRARY_CYCLE_UNITS.of(unit.library).toListOf(CREATED_RESOLVED_UNIT10)
};
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698