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

Side by Side Diff: pkg/front_end/lib/src/fasta/scope.dart

Issue 2898183002: Prepare for development branch by updating externally-used API. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.scope; 5 library fasta.scope;
6 6
7 import 'builder/builder.dart' show Builder, TypeVariableBuilder; 7 import 'builder/builder.dart' show Builder, TypeVariableBuilder;
8 8
9 import 'errors.dart' show internalError; 9 import 'errors.dart' show InputError, internalError;
10 10
11 class MutableScope { 11 class MutableScope {
12 /// Names declared in this scope. 12 /// Names declared in this scope.
13 Map<String, Builder> local; 13 Map<String, Builder> local;
14 14
15 /// Setters declared in this scope. 15 /// Setters declared in this scope.
16 Map<String, Builder> setters; 16 Map<String, Builder> setters;
17 17
18 /// The scope that this scope is nested within, or `null` if this is the top 18 /// The scope that this scope is nested within, or `null` if this is the top
19 /// level scope. 19 /// level scope.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 Map<String, Builder> get unclaimedForwardDeclarations { 162 Map<String, Builder> get unclaimedForwardDeclarations {
163 return forwardDeclaredLabels; 163 return forwardDeclaredLabels;
164 } 164 }
165 165
166 Builder lookupLabel(String name) { 166 Builder lookupLabel(String name) {
167 return (labels == null ? null : labels[name]) ?? parent?.lookupLabel(name); 167 return (labels == null ? null : labels[name]) ?? parent?.lookupLabel(name);
168 } 168 }
169 169
170 // TODO(ahe): Rename to extend or something. 170 InputError declare(
171 void operator []=(String name, Builder member) { 171 String name, Builder builder, int charOffset, Uri fileUri) {
scheglov 2017/05/23 16:14:45 Please document the method and meaning of the para
ahe 2017/05/24 10:54:20 Done.
172 if (isModifiable) { 172 if (isModifiable) {
173 local[name] = member; 173 local[name] = member;
174 } else { 174 } else {
175 internalError("Can't extend an unmodifiable scope."); 175 internalError("Can't extend an unmodifiable scope.");
176 } 176 }
177 return null;
ahe 2017/05/23 15:04:24 Will eventually return an InputError if the name i
177 } 178 }
178 179
179 void merge(Scope scope, 180 void merge(Scope scope,
180 buildAmbiguousBuilder(String name, Builder existing, Builder member)) { 181 buildAmbiguousBuilder(String name, Builder existing, Builder member)) {
181 Map<String, Builder> map = local; 182 Map<String, Builder> map = local;
182 183
183 void mergeMember(String name, Builder member) { 184 void mergeMember(String name, Builder member) {
184 Builder existing = map[name]; 185 Builder existing = map[name];
185 if (existing != null) { 186 if (existing != null) {
186 if (existing != member) { 187 if (existing != member) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 288
288 String get message => "Access error: '$name'."; 289 String get message => "Access error: '$name'.";
289 } 290 }
290 291
291 class AmbiguousBuilder extends ProblemBuilder { 292 class AmbiguousBuilder extends ProblemBuilder {
292 AmbiguousBuilder(String name, Builder builder, int charOffset, Uri fileUri) 293 AmbiguousBuilder(String name, Builder builder, int charOffset, Uri fileUri)
293 : super(name, builder, charOffset, fileUri); 294 : super(name, builder, charOffset, fileUri);
294 295
295 String get message => "Duplicated named: '$name'."; 296 String get message => "Duplicated named: '$name'.";
296 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698