| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:collection' show IterableMixin; | 5 import 'dart:collection' show IterableMixin; |
| 6 | 6 |
| 7 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage; | 7 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage; |
| 8 import 'package:front_end/src/fasta/scanner.dart' show BeginGroupToken, Token; | 8 import 'package:front_end/src/fasta/scanner.dart' show BeginGroupToken, Token; |
| 9 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens | 9 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens |
| 10 show PLUS_TOKEN; | 10 show PLUS_TOKEN; |
| (...skipping 3243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 | 3254 |
| 3255 /// Null implementation of [TreeElementMixin] which does not allow association | 3255 /// Null implementation of [TreeElementMixin] which does not allow association |
| 3256 /// of elements. | 3256 /// of elements. |
| 3257 /// | 3257 /// |
| 3258 /// This class is the superclass of all AST nodes. | 3258 /// This class is the superclass of all AST nodes. |
| 3259 abstract class NullTreeElementMixin implements TreeElementMixin, Spannable { | 3259 abstract class NullTreeElementMixin implements TreeElementMixin, Spannable { |
| 3260 // Deliberately using [Object] here to thwart code completion. | 3260 // Deliberately using [Object] here to thwart code completion. |
| 3261 // You're not really supposed to access this field anyways. | 3261 // You're not really supposed to access this field anyways. |
| 3262 Object get _element => null; | 3262 Object get _element => null; |
| 3263 set _element(_) { | 3263 set _element(_) { |
| 3264 assert(invariant(this, false, | 3264 assert(false, |
| 3265 message: "Elements cannot be associated with ${runtimeType}.")); | 3265 failedAt(this, "Elements cannot be associated with ${runtimeType}.")); |
| 3266 } | 3266 } |
| 3267 } | 3267 } |
| 3268 | 3268 |
| 3269 /// Actual implementation of [TreeElementMixin] which stores the associated | 3269 /// Actual implementation of [TreeElementMixin] which stores the associated |
| 3270 /// element in the private field [_element]. | 3270 /// element in the private field [_element]. |
| 3271 /// | 3271 /// |
| 3272 /// This class is mixed into the node classes that are actually associated with | 3272 /// This class is mixed into the node classes that are actually associated with |
| 3273 /// elements. | 3273 /// elements. |
| 3274 abstract class StoredTreeElementMixin implements TreeElementMixin { | 3274 abstract class StoredTreeElementMixin implements TreeElementMixin { |
| 3275 Object _element; | 3275 Object _element; |
| 3276 } | 3276 } |
| 3277 | 3277 |
| 3278 /** | 3278 /** |
| 3279 * Do not call this method directly. Instead, use an instance of | 3279 * Do not call this method directly. Instead, use an instance of |
| 3280 * TreeElements. | 3280 * TreeElements. |
| 3281 * | 3281 * |
| 3282 * Using [Object] as return type to thwart code completion. | 3282 * Using [Object] as return type to thwart code completion. |
| 3283 */ | 3283 */ |
| 3284 Object getTreeElement(TreeElementMixin node) => node._element; | 3284 Object getTreeElement(TreeElementMixin node) => node._element; |
| 3285 | 3285 |
| 3286 /** | 3286 /** |
| 3287 * Do not call this method directly. Instead, use an instance of | 3287 * Do not call this method directly. Instead, use an instance of |
| 3288 * TreeElements. | 3288 * TreeElements. |
| 3289 */ | 3289 */ |
| 3290 void setTreeElement(TreeElementMixin node, Object value) { | 3290 void setTreeElement(TreeElementMixin node, Object value) { |
| 3291 node._element = value; | 3291 node._element = value; |
| 3292 } | 3292 } |
| OLD | NEW |