| 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 /** | 5 /** |
| 6 * Encapsulates the field [TreeElementMixin._element]. | 6 * Encapsulates the field [TreeElementMixin._element]. |
| 7 * | 7 * |
| 8 * This library is an implementation detail of dart2js, and should not | 8 * This library is an implementation detail of dart2js, and should not |
| 9 * be imported except by resolution and tree node libraries, or for | 9 * be imported except by resolution and tree node libraries, or for |
| 10 * testing. | 10 * testing. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 abstract class TreeElementMixin { | 24 abstract class TreeElementMixin { |
| 25 Object get _element; | 25 Object get _element; |
| 26 void set _element(Object value); | 26 void set _element(Object value); |
| 27 } | 27 } |
| 28 | 28 |
| 29 /// Null implementation of [TreeElementMixin] which does not allow association | 29 /// Null implementation of [TreeElementMixin] which does not allow association |
| 30 /// of elements. | 30 /// of elements. |
| 31 /// | 31 /// |
| 32 /// This class is the superclass of all AST nodes. | 32 /// This class is the superclass of all AST nodes. |
| 33 abstract class NullTreeElementMixin implements TreeElementMixin, Spannable { | 33 abstract class NullTreeElementMixin implements TreeElementMixin, Spannable { |
| 34 | |
| 35 // Deliberately using [Object] here to thwart code completion. | 34 // Deliberately using [Object] here to thwart code completion. |
| 36 // You're not really supposed to access this field anyways. | 35 // You're not really supposed to access this field anyways. |
| 37 Object get _element => null; | 36 Object get _element => null; |
| 38 set _element(_) { | 37 set _element(_) { |
| 39 assert(invariant(this, false, | 38 assert(invariant(this, false, |
| 40 message: "Elements cannot be associated with ${runtimeType}.")); | 39 message: "Elements cannot be associated with ${runtimeType}.")); |
| 41 } | 40 } |
| 42 } | 41 } |
| 43 | 42 |
| 44 /// Actual implementation of [TreeElementMixin] which stores the associated | 43 /// Actual implementation of [TreeElementMixin] which stores the associated |
| (...skipping 13 matching lines...) Expand all Loading... |
| 58 */ | 57 */ |
| 59 Object getTreeElement(TreeElementMixin node) => node._element; | 58 Object getTreeElement(TreeElementMixin node) => node._element; |
| 60 | 59 |
| 61 /** | 60 /** |
| 62 * Do not call this method directly. Instead, use an instance of | 61 * Do not call this method directly. Instead, use an instance of |
| 63 * TreeElements. | 62 * TreeElements. |
| 64 */ | 63 */ |
| 65 void setTreeElement(TreeElementMixin node, Object value) { | 64 void setTreeElement(TreeElementMixin node, Object value) { |
| 66 node._element = value; | 65 node._element = value; |
| 67 } | 66 } |
| OLD | NEW |