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

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

Issue 1124923002: Compute explicit imports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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/task/dart.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 14f0d95c845995c2d90ce1fda49a16d833f33f81..a13c7993c205cc14f380fa92590ffdc213b3c95d 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -1910,6 +1910,7 @@ class GenerateHintsTask extends SourceBasedAnalysisTask {
*/
class ParseDartMemento {
final Token inputTokenStream;
+ final List<Source> explicitlyImportedLibraries;
final List<Source> exportedLibraries;
final List<Source> importedLibraries;
final List<Source> includedParts;
@@ -1917,7 +1918,7 @@ class ParseDartMemento {
final CompilationUnit parsedUnit;
final SourceKind sourceKind;
final List<Source> units;
- ParseDartMemento(this.inputTokenStream, this.exportedLibraries,
+ ParseDartMemento(this.inputTokenStream, this.explicitlyImportedLibraries, this.exportedLibraries,
this.importedLibraries, this.includedParts, this.parseErrors,
this.parsedUnit, this.sourceKind, this.units);
}
@@ -1942,6 +1943,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
*/
static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('ParseDartTask',
createTask, buildInputs, <ResultDescriptor>[
+ EXPLICITLY_IMPORTED_LIBRARIES,
EXPORTED_LIBRARIES,
IMPORTED_LIBRARIES,
INCLUDED_PARTS,
@@ -1971,6 +1973,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
ParseDartMemento memento = inputMemento;
if (identical(memento.inputTokenStream, tokenStream)) {
outputMemento = memento;
+ outputs[EXPLICITLY_IMPORTED_LIBRARIES] = memento.explicitlyImportedLibraries;
outputs[EXPORTED_LIBRARIES] = memento.exportedLibraries;
outputs[IMPORTED_LIBRARIES] = memento.importedLibraries;
outputs[INCLUDED_PARTS] = memento.includedParts;
@@ -1991,8 +1994,8 @@ class ParseDartTask extends SourceBasedAnalysisTask {
bool hasNonPartOfDirective = false;
bool hasPartOfDirective = false;
+ HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>();
HashSet<Source> exportedSourceSet = new HashSet<Source>();
- HashSet<Source> importedSourceSet = new HashSet<Source>();
HashSet<Source> includedSourceSet = new HashSet<Source>();
for (Directive directive in unit.directives) {
if (directive is PartOfDirective) {
@@ -2006,7 +2009,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
if (directive is ExportDirective) {
exportedSourceSet.add(referencedSource);
} else if (directive is ImportDirective) {
- importedSourceSet.add(referencedSource);
+ explicitlyImportedSourceSet.add(referencedSource);
} else if (directive is PartDirective) {
if (referencedSource != source) {
includedSourceSet.add(referencedSource);
@@ -2022,6 +2025,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
//
// Always include "dart:core" source.
//
+ HashSet<Source> importedSourceSet = new HashSet.from(explicitlyImportedSourceSet);
Source coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE);
importedSourceSet.add(coreLibrarySource);
//
@@ -2034,11 +2038,13 @@ class ParseDartTask extends SourceBasedAnalysisTask {
//
// Record outputs.
//
+ List<Source> explicitlyImportedSources = explicitlyImportedSourceSet.toList();
List<Source> exportedSources = exportedSourceSet.toList();
List<Source> importedSources = importedSourceSet.toList();
List<Source> includedSources = includedSourceSet.toList();
List<AnalysisError> parseErrors = errorListener.errors;
List<Source> unitSources = <Source>[source]..addAll(includedSourceSet);
+ outputs[EXPLICITLY_IMPORTED_LIBRARIES] = explicitlyImportedSources;
outputs[EXPORTED_LIBRARIES] = exportedSources;
outputs[IMPORTED_LIBRARIES] = importedSources;
outputs[INCLUDED_PARTS] = includedSources;
@@ -2046,7 +2052,7 @@ class ParseDartTask extends SourceBasedAnalysisTask {
outputs[PARSED_UNIT] = unit;
outputs[SOURCE_KIND] = sourceKind;
outputs[UNITS] = unitSources;
- outputMemento = new ParseDartMemento(tokenStream, exportedSources,
+ outputMemento = new ParseDartMemento(tokenStream, explicitlyImportedSources, exportedSources,
importedSources, includedSources, parseErrors, unit, sourceKind,
unitSources);
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/task/dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698