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

Unified Diff: pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Issue 2780543002: Handle complicated imports. (Closed)
Patch Set: Fix infinite loop. Created 3 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/front_end/lib/src/fasta/source/source_library_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index b5e57e00918de3baecb3d76ee501fc3d9ca1945c..139ba365a186ea05e326ff972c599bf1630775f7 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -273,7 +273,7 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
Builder other = existing.exports.putIfAbsent(name, () => builder);
if (other != builder) {
existing.exports[name] =
- other.combineAmbiguousImport(name, builder, this);
+ buildAmbiguousBuilder(name, other, builder, charOffset);
}
});
return existing;
@@ -383,7 +383,9 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
void buildInitialScopes() {
members.forEach(addToExportScope);
- members.forEach(addToScope);
+ members.forEach((String name, Builder member) {
+ addToScope(name, member, member.charOffset, false);
+ });
}
void addImportsToScope() {
@@ -395,17 +397,21 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
import.finalizeImports(this);
}
if (!explicitCoreImport) {
- loader.coreLibrary.exports.forEach(addToScope);
+ loader.coreLibrary.exports.forEach((String name, Builder member) {
+ addToScope(name, member, -1, true);
+ });
}
}
- void addToScope(String name, Builder member) {
+ @override
+ void addToScope(String name, Builder member, int charOffset, bool isImport) {
Builder existing = scope.lookup(name, member.charOffset, fileUri);
if (existing != null) {
if (existing != member) {
- scope.local[name] = existing.combineAmbiguousImport(name, member, this);
+ scope.local[name] = buildAmbiguousBuilder(
+ name, existing, member, charOffset,
+ isImport: isImport);
}
- // TODO(ahe): handle duplicated names.
} else {
scope.local[name] = member;
}
@@ -418,7 +424,10 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
Builder existing = exports[name];
if (existing == member) return false;
if (existing != null) {
- exports[name] = buildAmbiguousBuilder(name, existing, member, -1);
+ Builder result =
+ buildAmbiguousBuilder(name, existing, member, -1, isExport: true);
+ exports[name] = result;
+ return result != existing;
} else {
exports[name] = member;
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart ('k') | tests/language/language_kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698