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

Unified Diff: pkg/front_end/lib/src/fasta/builder/library_builder.dart

Issue 2788913002: Prepare for separate setter scope. (Closed)
Patch Set: Address comments. 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/builder/library_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index f6408efea82fe144fed7b9900b8e1c7c8fbb2342..2010800716e5cdfd9685084464300f6db8da4f6a 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -108,7 +108,8 @@ abstract class LibraryBuilder<T extends TypeBuilder, R> extends Builder {
if (cls is ClassBuilder) {
// TODO(ahe): This code is similar to code in `endNewExpression` in
// `body_builder.dart`, try to share it.
- Builder constructor = cls.findConstructorOrFactory(constructorName);
+ Builder constructor =
+ cls.findConstructorOrFactory(constructorName, -1, null);
if (constructor == null) {
// Fall-through to internal error below.
} else if (constructor.isConstructor) {
@@ -130,4 +131,18 @@ abstract class LibraryBuilder<T extends TypeBuilder, R> extends Builder {
new DynamicTypeBuilder<T, dynamic>(dynamicType, this, -1), -1);
addBuilder("void", new VoidTypeBuilder<T, dynamic>(voidType, this, -1), -1);
}
+
+ void forEach(void f(String name, Builder builder)) {
+ members.forEach(f);
+ }
+
+ /// Don't use for scope lookup. Only use when an element is known to exist
+ /// (and not a setter).
+ Builder operator [](String name) {
+ return members[name] ?? internalError("Not found: '$name'.");
+ }
+
+ Builder lookup(String name, int charOffset, Uri fileUri) {
+ return members[name];
+ }
}

Powered by Google App Engine
This is Rietveld 408576698