OLD | NEW |
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 'fasta_codes.dart' | 9 import 'fasta_codes.dart' |
10 show | 10 show |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 ScopeBuilder(this.scope); | 273 ScopeBuilder(this.scope); |
274 | 274 |
275 void addMember(String name, Builder builder) { | 275 void addMember(String name, Builder builder) { |
276 scope.local[name] = builder; | 276 scope.local[name] = builder; |
277 } | 277 } |
278 | 278 |
279 void addSetter(String name, Builder builder) { | 279 void addSetter(String name, Builder builder) { |
280 scope.setters[name] = builder; | 280 scope.setters[name] = builder; |
281 } | 281 } |
282 | 282 |
283 Builder operator [](String name) { | 283 Builder operator [](String name) => scope.local[name]; |
284 return scope.local[name] ?? scope.setters[name]; | |
285 } | |
286 } | 284 } |
287 | 285 |
288 abstract class ProblemBuilder extends Builder { | 286 abstract class ProblemBuilder extends Builder { |
289 final String name; | 287 final String name; |
290 | 288 |
291 final Builder builder; | 289 final Builder builder; |
292 | 290 |
293 ProblemBuilder(this.name, this.builder, int charOffset, Uri fileUri) | 291 ProblemBuilder(this.name, this.builder, int charOffset, Uri fileUri) |
294 : super(null, charOffset, fileUri); | 292 : super(null, charOffset, fileUri); |
295 | 293 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 331 |
334 Message get message => templateAccessError.withArguments(name); | 332 Message get message => templateAccessError.withArguments(name); |
335 } | 333 } |
336 | 334 |
337 class AmbiguousBuilder extends ProblemBuilder { | 335 class AmbiguousBuilder extends ProblemBuilder { |
338 AmbiguousBuilder(String name, Builder builder, int charOffset, Uri fileUri) | 336 AmbiguousBuilder(String name, Builder builder, int charOffset, Uri fileUri) |
339 : super(name, builder, charOffset, fileUri); | 337 : super(name, builder, charOffset, fileUri); |
340 | 338 |
341 Message get message => templateDuplicatedName.withArguments(name); | 339 Message get message => templateDuplicatedName.withArguments(name); |
342 } | 340 } |
OLD | NEW |