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

Unified Diff: pkg/front_end/lib/src/fasta/scope.dart

Issue 2898183002: Prepare for development branch by updating externally-used API. (Closed)
Patch Set: Minor tweaks found during testing. Created 3 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 | « pkg/front_end/lib/src/fasta/loader.dart ('k') | pkg/front_end/lib/src/fasta/source/diet_listener.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/scope.dart
diff --git a/pkg/front_end/lib/src/fasta/scope.dart b/pkg/front_end/lib/src/fasta/scope.dart
index 2dd1656ef0bf633fb525fc4f7574981daa07c032..6fdcce39f2de503e04f14655386b2e44ce6dcbb4 100644
--- a/pkg/front_end/lib/src/fasta/scope.dart
+++ b/pkg/front_end/lib/src/fasta/scope.dart
@@ -6,7 +6,7 @@ library fasta.scope;
import 'builder/builder.dart' show Builder, TypeVariableBuilder;
-import 'errors.dart' show internalError;
+import 'errors.dart' show InputError, internalError;
class MutableScope {
/// Names declared in this scope.
@@ -167,13 +167,20 @@ class Scope extends MutableScope {
return (labels == null ? null : labels[name]) ?? parent?.lookupLabel(name);
}
- // TODO(ahe): Rename to extend or something.
- void operator []=(String name, Builder member) {
+ /// Declares that the meaning of [name] in this scope is [builder].
+ ///
+ /// If name was used previously in this scope, this method returns an error
+ /// that should be reported as a compile-time error. The position of this
+ /// error is given by [charOffset] and [fileUri].
+ InputError declare(
+ String name, Builder builder, int charOffset, Uri fileUri) {
if (isModifiable) {
- local[name] = member;
+ local[name] = builder;
} else {
internalError("Can't extend an unmodifiable scope.");
}
+ // TODO(ahe): Return an error if [name] was already used in this scope.
+ return null;
}
void merge(Scope scope,
« no previous file with comments | « pkg/front_end/lib/src/fasta/loader.dart ('k') | pkg/front_end/lib/src/fasta/source/diet_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698