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 library dart2js.resolution.tree_elements; | 5 library dart2js.resolution.tree_elements; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
10 import '../diagnostics/source_span.dart'; | 10 import '../diagnostics/source_span.dart'; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 Map<Node, dynamic> _nativeData; | 126 Map<Node, dynamic> _nativeData; |
127 | 127 |
128 final int hashCode = _hashCodeCounter = (_hashCodeCounter + 1).toUnsigned(30); | 128 final int hashCode = _hashCodeCounter = (_hashCodeCounter + 1).toUnsigned(30); |
129 static int _hashCodeCounter = 0; | 129 static int _hashCodeCounter = 0; |
130 | 130 |
131 TreeElementMapping(this.analyzedElement); | 131 TreeElementMapping(this.analyzedElement); |
132 | 132 |
133 operator []=(Node node, Element element) { | 133 operator []=(Node node, Element element) { |
134 // TODO(johnniwinther): Simplify this invariant to use only declarations in | 134 // TODO(johnniwinther): Simplify this invariant to use only declarations in |
135 // [TreeElements]. | 135 // [TreeElements]. |
136 assert(invariant(node, () { | 136 assert(() { |
137 if (!element.isMalformed && analyzedElement != null && element.isPatch) { | 137 if (!element.isMalformed && analyzedElement != null && element.isPatch) { |
138 return analyzedElement.implementationLibrary.isPatch; | 138 return analyzedElement.implementationLibrary.isPatch; |
139 } | 139 } |
140 return true; | 140 return true; |
141 })); | 141 }, failedAt(node)); |
142 // TODO(ahe): Investigate why the invariant below doesn't hold. | 142 // TODO(ahe): Investigate why the invariant below doesn't hold. |
143 // assert(invariant(node, | 143 // assert(invariant(node, |
144 // getTreeElement(node) == element || | 144 // getTreeElement(node) == element || |
145 // getTreeElement(node) == null, | 145 // getTreeElement(node) == null, |
146 // message: '${getTreeElement(node)}; $element')); | 146 // message: '${getTreeElement(node)}; $element')); |
147 | 147 |
148 setTreeElement(node, element); | 148 setTreeElement(node, element); |
149 } | 149 } |
150 | 150 |
151 @override | 151 @override |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 _nativeData = <Node, dynamic>{}; | 428 _nativeData = <Node, dynamic>{}; |
429 } | 429 } |
430 _nativeData[node] = nativeData; | 430 _nativeData[node] = nativeData; |
431 } | 431 } |
432 | 432 |
433 @override | 433 @override |
434 dynamic getNativeData(Node node) { | 434 dynamic getNativeData(Node node) { |
435 return _nativeData != null ? _nativeData[node] : null; | 435 return _nativeData != null ? _nativeData[node] : null; |
436 } | 436 } |
437 } | 437 } |
OLD | NEW |