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 void forEachConstantNode(f(Node n, ConstantExpression c)); | 14 void forEachConstantNode(f(Node n, ConstantExpression c)); |
15 | 15 |
16 /// A set of additional dependencies. See [registerDependency] below. | 16 /// A set of additional dependencies. See [registerDependency] below. |
17 Iterable<Element> get otherDependencies; | 17 Iterable<Element> get otherDependencies; |
18 | 18 |
19 Element operator[](Node node); | 19 Element operator[](Node node); |
| 20 Map<Node, DartType> get typesCache; |
20 | 21 |
21 SendStructure getSendStructure(Send send); | 22 SendStructure getSendStructure(Send send); |
22 | 23 |
23 // TODO(johnniwinther): Investigate whether [Node] could be a [Send]. | 24 // TODO(johnniwinther): Investigate whether [Node] could be a [Send]. |
24 Selector getSelector(Node node); | 25 Selector getSelector(Node node); |
25 Selector getGetterSelectorInComplexSendSet(SendSet node); | 26 Selector getGetterSelectorInComplexSendSet(SendSet node); |
26 Selector getOperatorSelectorInComplexSendSet(SendSet node); | 27 Selector getOperatorSelectorInComplexSendSet(SendSet node); |
27 DartType getType(Node node); | 28 DartType getType(Node node); |
28 TypeMask getTypeMask(Node node); | 29 TypeMask getTypeMask(Node node); |
29 TypeMask getGetterTypeMaskInComplexSendSet(SendSet node); | 30 TypeMask getGetterTypeMaskInComplexSendSet(SendSet node); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 94 |
94 /// Returns the label that [node] targets. | 95 /// Returns the label that [node] targets. |
95 LabelDefinition getTargetLabel(GotoStatement node); | 96 LabelDefinition getTargetLabel(GotoStatement node); |
96 } | 97 } |
97 | 98 |
98 class TreeElementMapping extends TreeElements { | 99 class TreeElementMapping extends TreeElements { |
99 final AnalyzableElement analyzedElement; | 100 final AnalyzableElement analyzedElement; |
100 Map<Spannable, Selector> _selectors; | 101 Map<Spannable, Selector> _selectors; |
101 Map<Spannable, TypeMask> _typeMasks; | 102 Map<Spannable, TypeMask> _typeMasks; |
102 Map<Node, DartType> _types; | 103 Map<Node, DartType> _types; |
| 104 Map<Node, DartType> typesCache = <Node, DartType>{}; |
103 Setlet<Node> _superUses; | 105 Setlet<Node> _superUses; |
104 Setlet<Element> _otherDependencies; | 106 Setlet<Element> _otherDependencies; |
105 Map<Node, ConstantExpression> _constants; | 107 Map<Node, ConstantExpression> _constants; |
106 Map<VariableElement, List<Node>> _potentiallyMutated; | 108 Map<VariableElement, List<Node>> _potentiallyMutated; |
107 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn; | 109 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn; |
108 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure; | 110 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure; |
109 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn; | 111 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn; |
110 Setlet<Element> _elements; | 112 Setlet<Element> _elements; |
111 Setlet<Send> _asserts; | 113 Setlet<Send> _asserts; |
112 Maplet<Send, SendStructure> _sendStructureMap; | 114 Maplet<Send, SendStructure> _sendStructureMap; |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 TreeElements get treeElements { | 528 TreeElements get treeElements { |
527 assert(invariant(this, _treeElements !=null, | 529 assert(invariant(this, _treeElements !=null, |
528 message: "TreeElements have not been computed for $this.")); | 530 message: "TreeElements have not been computed for $this.")); |
529 return _treeElements; | 531 return _treeElements; |
530 } | 532 } |
531 | 533 |
532 void reuseElement() { | 534 void reuseElement() { |
533 _treeElements = null; | 535 _treeElements = null; |
534 } | 536 } |
535 } | 537 } |
OLD | NEW |