Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: pkg/compiler/lib/src/resolution/tree_elements.dart

Issue 1416253002: Remove requiredTypes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
11 import '../types/types.dart' show 11 import '../types/types.dart' show
12 TypeMask; 12 TypeMask;
13 import '../tree/tree.dart'; 13 import '../tree/tree.dart';
14 import '../util/util.dart'; 14 import '../util/util.dart';
15 import '../universe/selector.dart' show 15 import '../universe/selector.dart' show
16 Selector; 16 Selector;
17 17
18 import 'secret_tree_element.dart' show 18 import 'secret_tree_element.dart' show
19 getTreeElement, 19 getTreeElement,
20 setTreeElement; 20 setTreeElement;
21 import 'send_structure.dart'; 21 import 'send_structure.dart';
22 22
23 abstract class TreeElements { 23 abstract class TreeElements {
24 AnalyzableElement get analyzedElement; 24 AnalyzableElement get analyzedElement;
25 Iterable<Node> get superUses; 25 Iterable<Node> get superUses;
26 26
27 /// The set of types that this TreeElement depends on.
28 /// This includes instantiated types, types in is-checks and as-expressions
29 /// and in checked mode the types of all type-annotations.
30 Iterable<DartType> get requiredTypes;
31
32 void forEachConstantNode(f(Node n, ConstantExpression c)); 27 void forEachConstantNode(f(Node n, ConstantExpression c));
33 28
34 Element operator[](Node node); 29 Element operator[](Node node);
35 Map<Node, DartType> get typesCache; 30 Map<Node, DartType> get typesCache;
36 31
37 SendStructure getSendStructure(Send send); 32 SendStructure getSendStructure(Send send);
38 33
39 // TODO(johnniwinther): Investigate whether [Node] could be a [Send]. 34 // TODO(johnniwinther): Investigate whether [Node] could be a [Send].
40 Selector getSelector(Node node); 35 Selector getSelector(Node node);
41 Selector getGetterSelectorInComplexSendSet(SendSet node); 36 Selector getGetterSelectorInComplexSendSet(SendSet node);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 * Returns [:true:] if [node] is a type literal. 68 * Returns [:true:] if [node] is a type literal.
74 * 69 *
75 * Resolution marks this by setting the type on the node to be the 70 * Resolution marks this by setting the type on the node to be the
76 * type that the literal refers to. 71 * type that the literal refers to.
77 */ 72 */
78 bool isTypeLiteral(Send node); 73 bool isTypeLiteral(Send node);
79 74
80 /// Returns the type that the type literal [node] refers to. 75 /// Returns the type that the type literal [node] refers to.
81 DartType getTypeLiteralType(Send node); 76 DartType getTypeLiteralType(Send node);
82 77
83 /// Register a dependency on [type].
84 void addRequiredType(DartType type);
85
86 /// Returns a list of nodes that potentially mutate [element] anywhere in its 78 /// Returns a list of nodes that potentially mutate [element] anywhere in its
87 /// scope. 79 /// scope.
88 List<Node> getPotentialMutations(VariableElement element); 80 List<Node> getPotentialMutations(VariableElement element);
89 81
90 /// Returns a list of nodes that potentially mutate [element] in [node]. 82 /// Returns a list of nodes that potentially mutate [element] in [node].
91 List<Node> getPotentialMutationsIn(Node node, VariableElement element); 83 List<Node> getPotentialMutationsIn(Node node, VariableElement element);
92 84
93 /// Returns a list of nodes that potentially mutate [element] in a closure. 85 /// Returns a list of nodes that potentially mutate [element] in a closure.
94 List<Node> getPotentialMutationsInClosure(VariableElement element); 86 List<Node> getPotentialMutationsInClosure(VariableElement element);
95 87
(...skipping 22 matching lines...) Expand all
118 Map<Spannable, TypeMask> _typeMasks; 110 Map<Spannable, TypeMask> _typeMasks;
119 Map<Node, DartType> _types; 111 Map<Node, DartType> _types;
120 Map<Node, DartType> typesCache = <Node, DartType>{}; 112 Map<Node, DartType> typesCache = <Node, DartType>{};
121 Setlet<Node> _superUses; 113 Setlet<Node> _superUses;
122 Map<Node, ConstantExpression> _constants; 114 Map<Node, ConstantExpression> _constants;
123 Map<VariableElement, List<Node>> _potentiallyMutated; 115 Map<VariableElement, List<Node>> _potentiallyMutated;
124 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn; 116 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn;
125 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure; 117 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure;
126 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn; 118 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn;
127 Maplet<Send, SendStructure> _sendStructureMap; 119 Maplet<Send, SendStructure> _sendStructureMap;
128 Setlet<DartType> _requiredTypes;
129 bool containsTryStatement = false; 120 bool containsTryStatement = false;
130 121
131 /// Map from nodes to the targets they define. 122 /// Map from nodes to the targets they define.
132 Map<Node, JumpTarget> _definedTargets; 123 Map<Node, JumpTarget> _definedTargets;
133 124
134 /// Map from goto statements to their targets. 125 /// Map from goto statements to their targets.
135 Map<GotoStatement, JumpTarget> _usedTargets; 126 Map<GotoStatement, JumpTarget> _usedTargets;
136 127
137 /// Map from labels to their label definition. 128 /// Map from labels to their label definition.
138 Map<Label, LabelDefinition> _definedLabels; 129 Map<Label, LabelDefinition> _definedLabels;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 170
180 void setType(Node node, DartType type) { 171 void setType(Node node, DartType type) {
181 if (_types == null) { 172 if (_types == null) {
182 _types = new Maplet<Node, DartType>(); 173 _types = new Maplet<Node, DartType>();
183 } 174 }
184 _types[node] = type; 175 _types[node] = type;
185 } 176 }
186 177
187 DartType getType(Node node) => _types != null ? _types[node] : null; 178 DartType getType(Node node) => _types != null ? _types[node] : null;
188 179
189 void addRequiredType(DartType type) {
190 if (_requiredTypes == null) _requiredTypes = new Setlet<DartType>();
191 _requiredTypes.add(type);
192 }
193
194 Iterable<DartType> get requiredTypes {
195 if (_requiredTypes == null) {
196 return const <DartType>[];
197 } else {
198 return _requiredTypes;
199 }
200 }
201
202 Iterable<Node> get superUses { 180 Iterable<Node> get superUses {
203 return _superUses != null ? _superUses : const <Node>[]; 181 return _superUses != null ? _superUses : const <Node>[];
204 } 182 }
205 183
206 void addSuperUse(Node node) { 184 void addSuperUse(Node node) {
207 if (_superUses == null) { 185 if (_superUses == null) {
208 _superUses = new Setlet<Node>(); 186 _superUses = new Setlet<Node>();
209 } 187 }
210 _superUses.add(node); 188 _superUses.add(node);
211 } 189 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 480 }
503 481
504 void setCurrentTypeMask(ForIn node, TypeMask mask) { 482 void setCurrentTypeMask(ForIn node, TypeMask mask) {
505 _setTypeMask(node.inToken, mask); 483 _setTypeMask(node.inToken, mask);
506 } 484 }
507 485
508 TypeMask getCurrentTypeMask(ForIn node) { 486 TypeMask getCurrentTypeMask(ForIn node) {
509 return _getTypeMask(node.inToken); 487 return _getTypeMask(node.inToken);
510 } 488 }
511 } 489 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | pkg/compiler/lib/src/resolution/variables.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698