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

Unified Diff: pkg/front_end/lib/src/fasta/builder/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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/builder/invalid_type_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/builder/builder.dart
diff --git a/pkg/front_end/lib/src/fasta/builder/builder.dart b/pkg/front_end/lib/src/fasta/builder/builder.dart
index 1ac63cf5ad2111dfa2a1705e8a1916720fdddf83..26ba0acc74e8c1ccfd2d9245c599b0c894d5670e 100644
--- a/pkg/front_end/lib/src/fasta/builder/builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/builder.dart
@@ -6,8 +6,6 @@ library fasta.builder;
import '../errors.dart' show internalError;
-import '../messages.dart' show nit;
-
export 'class_builder.dart' show ClassBuilder;
export 'field_builder.dart' show FieldBuilder;
@@ -62,8 +60,6 @@ export 'function_type_builder.dart' show FunctionTypeBuilder;
import 'library_builder.dart' show LibraryBuilder;
-import 'invalid_type_builder.dart' show InvalidTypeBuilder;
-
abstract class Builder {
/// Used when multiple things with the same name are declared within the same
/// parent. Only used for declarations, not for scopes.
@@ -94,54 +90,6 @@ abstract class Builder {
/// return the number of constructors resolved.
int resolveConstructors(covariant Builder parent) => 0;
- /// This builder and [other] has been imported into [library] using [name].
- ///
- /// This method handles this case according to the Dart language
- /// specification.
- Builder combineAmbiguousImport(
- String name, Builder other, LibraryBuilder library) {
- if (other == this) return this;
- if (other is InvalidTypeBuilder) return other;
- bool isLocal = false;
- Builder preferred;
- Builder hidden;
- if (library.members[name] == this) {
- isLocal = true;
- preferred = this;
- hidden = other;
- } else if (getUri(other)?.scheme == "dart" &&
- getUri(this)?.scheme != "dart") {
- preferred = this;
- hidden = other;
- } else if (getUri(this)?.scheme == "dart" &&
- getUri(other)?.scheme != "dart") {
- preferred = other;
- hidden = this;
- } else {
- nit(
- library.fileUri,
- -1,
- "'$name' is imported from both "
- "'${getUri(this)}' and '${getUri(other)}'.");
- return library.buildAmbiguousBuilder(name, this, other, charOffset);
- }
- if (isLocal) {
- nit(
- library.fileUri,
- -1,
- "Local definition of '$name' hides imported "
- "version from '${getUri(other)}'.");
- } else {
- nit(
- library.fileUri,
- -1,
- "Import of '$name' "
- "(from '${getUri(preferred)}') hides imported version from "
- "'${getUri(hidden)}'.");
- }
- return preferred;
- }
-
Builder get parent => null;
bool get isFinal => false;
@@ -178,12 +126,12 @@ abstract class Builder {
String get fullNameForErrors;
- static Uri getUri(Builder builder) {
- if (builder == null) return internalError("Builder is null.");
- while (builder != null) {
+ Uri computeLibraryUri() {
+ Builder builder = this;
+ do {
if (builder is LibraryBuilder) return builder.uri;
builder = builder.parent;
- }
+ } while (builder != null);
return internalError("No library parent.");
}
}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/builder/invalid_type_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698