| 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.dart' show | 7 import 'builder.dart' show |
| 8 Builder, | 8 Builder, |
| 9 MixedAccessor; | 9 MixedAccessor; |
| 10 | 10 |
| 11 import '../errors.dart' show | 11 import '../errors.dart' show |
| 12 internalError; | 12 internalError; |
| 13 | 13 |
| 14 class Scope { | 14 class Scope { |
| 15 /// Names declared in this scope. |
| 15 final Map<String, Builder> local; | 16 final Map<String, Builder> local; |
| 16 | 17 |
| 18 /// The scope that this scope is nested within, or `null` if this is the top |
| 19 /// level scope. |
| 17 final Scope parent; | 20 final Scope parent; |
| 18 | 21 |
| 22 /// Indicates whether an attempt to declare new names in this scope should |
| 23 /// succeed. |
| 19 final bool isModifiable; | 24 final bool isModifiable; |
| 20 | 25 |
| 21 Scope(this.local, this.parent, {this.isModifiable: true}); | 26 Scope(this.local, this.parent, {this.isModifiable: true}); |
| 22 | 27 |
| 23 Scope createNestedScope({bool isModifiable: true}) { | 28 Scope createNestedScope({bool isModifiable: true}) { |
| 24 return new Scope(<String, Builder>{}, this, isModifiable: isModifiable); | 29 return new Scope(<String, Builder>{}, this, isModifiable: isModifiable); |
| 25 } | 30 } |
| 26 | 31 |
| 27 Builder lookup(String name) { | 32 Builder lookup(String name) { |
| 28 Builder builder = local[name]; | 33 Builder builder = local[name]; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 126 |
| 122 class AmbiguousBuilder extends Builder { | 127 class AmbiguousBuilder extends Builder { |
| 123 final Builder builder; | 128 final Builder builder; |
| 124 | 129 |
| 125 AmbiguousBuilder(this.builder); | 130 AmbiguousBuilder(this.builder); |
| 126 | 131 |
| 127 get target => null; | 132 get target => null; |
| 128 | 133 |
| 129 bool get hasProblem => true; | 134 bool get hasProblem => true; |
| 130 } | 135 } |
| OLD | NEW |