OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 abstract class _NamerName extends jsAst.Name { | 7 abstract class _NamerName extends jsAst.Name { |
8 int get _kind; | 8 int get _kind; |
9 _NamerName get _target => this; | 9 _NamerName get _target => this; |
10 | 10 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 bool operator==(other) { | 186 bool operator==(other) { |
187 if (other is _NameReference) other = other._target; | 187 if (other is _NameReference) other = other._target; |
188 if (identical(this, other)) return true; | 188 if (identical(this, other)) return true; |
189 return false; | 189 return false; |
190 } | 190 } |
191 | 191 |
192 @override | 192 @override |
193 int get hashCode => super.hashCode; | 193 int get hashCode => super.hashCode; |
194 | 194 |
195 finalize() { | 195 finalize() { |
196 assert(!isFinalized); | 196 assert(invariant(NO_LOCATION_SPANNABLE, !isFinalized, |
| 197 message: "TokenName($key)=$_name has already been finalized.")); |
197 _name = _scope.getNextName(); | 198 _name = _scope.getNextName(); |
198 } | 199 } |
199 } | 200 } |
200 | 201 |
201 class _NameReference extends _NamerName implements jsAst.AstContainer { | 202 class _NameReference extends _NamerName implements jsAst.AstContainer { |
202 _NamerName _target; | 203 _NamerName _target; |
203 | 204 |
204 int get _kind => _target._kind; | 205 int get _kind => _target._kind; |
205 String get key => _target.key; | 206 String get key => _target.key; |
206 | 207 |
207 Iterable<jsAst.Node> get containedNodes => [_target]; | 208 Iterable<jsAst.Node> get containedNodes => [_target]; |
208 | 209 |
209 _NameReference(this._target); | 210 _NameReference(this._target); |
210 | 211 |
211 String get name => _target.name; | 212 String get name => _target.name; |
212 | 213 |
213 @override | 214 @override |
214 int compareTo(_NamerName other) => _target.compareTo(other); | 215 int compareTo(_NamerName other) => _target.compareTo(other); |
215 | 216 |
216 @override | 217 @override |
217 bool operator==(other) => _target == other; | 218 bool operator==(other) => _target == other; |
218 | 219 |
219 @override | 220 @override |
220 int get hashCode => _target.hashCode; | 221 int get hashCode => _target.hashCode; |
221 } | 222 } |
OLD | NEW |