| 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 resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 AnalyzableElement get analyzedElement; | 8 AnalyzableElement get analyzedElement; |
| 9 Iterable<Node> get superUses; | 9 Iterable<Node> get superUses; |
| 10 | 10 |
| 11 /// Iterables of the dependencies that this [TreeElement] records of | 11 /// Iterables of the dependencies that this [TreeElement] records of |
| 12 /// [analyzedElement]. | 12 /// [analyzedElement]. |
| 13 Iterable<Element> get allElements; | 13 Iterable<Element> get allElements; |
| 14 |
| 14 void forEachConstantNode(f(Node n, ConstantExpression c)); | 15 void forEachConstantNode(f(Node n, ConstantExpression c)); |
| 16 void forEachType(f(Node n, DartType t)); |
| 15 | 17 |
| 16 /// A set of additional dependencies. See [registerDependency] below. | 18 /// A set of additional dependencies. See [registerDependency] below. |
| 17 Iterable<Element> get otherDependencies; | 19 Iterable<Element> get otherDependencies; |
| 18 | 20 |
| 19 Element operator[](Node node); | 21 Element operator[](Node node); |
| 20 | 22 |
| 21 SendStructure getSendStructure(Send send); | 23 SendStructure getSendStructure(Send send); |
| 22 | 24 |
| 23 // TODO(johnniwinther): Investigate whether [Node] could be a [Send]. | 25 // TODO(johnniwinther): Investigate whether [Node] could be a [Send]. |
| 24 Selector getSelector(Node node); | 26 Selector getSelector(Node node); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 168 |
| 167 void setType(Node node, DartType type) { | 169 void setType(Node node, DartType type) { |
| 168 if (_types == null) { | 170 if (_types == null) { |
| 169 _types = new Maplet<Node, DartType>(); | 171 _types = new Maplet<Node, DartType>(); |
| 170 } | 172 } |
| 171 _types[node] = type; | 173 _types[node] = type; |
| 172 } | 174 } |
| 173 | 175 |
| 174 DartType getType(Node node) => _types != null ? _types[node] : null; | 176 DartType getType(Node node) => _types != null ? _types[node] : null; |
| 175 | 177 |
| 178 void forEachType(f(Node n, DartType t)) { |
| 179 if (_types != null) { |
| 180 _types.forEach(f); |
| 181 } |
| 182 } |
| 183 |
| 176 Iterable<Node> get superUses { | 184 Iterable<Node> get superUses { |
| 177 return _superUses != null ? _superUses : const <Node>[]; | 185 return _superUses != null ? _superUses : const <Node>[]; |
| 178 } | 186 } |
| 179 | 187 |
| 180 void addSuperUse(Node node) { | 188 void addSuperUse(Node node) { |
| 181 if (_superUses == null) { | 189 if (_superUses == null) { |
| 182 _superUses = new Setlet<Node>(); | 190 _superUses = new Setlet<Node>(); |
| 183 } | 191 } |
| 184 _superUses.add(node); | 192 _superUses.add(node); |
| 185 } | 193 } |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 TreeElements get treeElements { | 534 TreeElements get treeElements { |
| 527 assert(invariant(this, _treeElements !=null, | 535 assert(invariant(this, _treeElements !=null, |
| 528 message: "TreeElements have not been computed for $this.")); | 536 message: "TreeElements have not been computed for $this.")); |
| 529 return _treeElements; | 537 return _treeElements; |
| 530 } | 538 } |
| 531 | 539 |
| 532 void reuseElement() { | 540 void reuseElement() { |
| 533 _treeElements = null; | 541 _treeElements = null; |
| 534 } | 542 } |
| 535 } | 543 } |
| OLD | NEW |