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

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

Issue 1437463005: Compute NewStructure in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 1 month 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';
(...skipping 11 matching lines...) Expand all
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 void forEachConstantNode(f(Node n, ConstantExpression c)); 27 void forEachConstantNode(f(Node n, ConstantExpression c));
28 28
29 Element operator[](Node node); 29 Element operator[](Node node);
30 Map<Node, DartType> get typesCache; 30 Map<Node, DartType> get typesCache;
31 31
32 SendStructure getSendStructure(Send send); 32 /// Returns the [SendStructure] that describes the semantics of [node].
33 SendStructure getSendStructure(Send node);
34
35 /// Returns the [NewStructure] that describes the semantics of [node].
36 NewStructure getNewStructure(NewExpression node);
33 37
34 // TODO(johnniwinther): Investigate whether [Node] could be a [Send]. 38 // TODO(johnniwinther): Investigate whether [Node] could be a [Send].
35 Selector getSelector(Node node); 39 Selector getSelector(Node node);
36 Selector getGetterSelectorInComplexSendSet(SendSet node); 40 Selector getGetterSelectorInComplexSendSet(SendSet node);
37 Selector getOperatorSelectorInComplexSendSet(SendSet node); 41 Selector getOperatorSelectorInComplexSendSet(SendSet node);
38 DartType getType(Node node); 42 DartType getType(Node node);
39 TypeMask getTypeMask(Node node); 43 TypeMask getTypeMask(Node node);
40 TypeMask getGetterTypeMaskInComplexSendSet(SendSet node); 44 TypeMask getGetterTypeMaskInComplexSendSet(SendSet node);
41 TypeMask getOperatorTypeMaskInComplexSendSet(SendSet node); 45 TypeMask getOperatorTypeMaskInComplexSendSet(SendSet node);
42 void setTypeMask(Node node, TypeMask mask); 46 void setTypeMask(Node node, TypeMask mask);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Map<Spannable, TypeMask> _typeMasks; 111 Map<Spannable, TypeMask> _typeMasks;
108 Map<Node, DartType> _types; 112 Map<Node, DartType> _types;
109 Map<Node, DartType> typesCache = <Node, DartType>{}; 113 Map<Node, DartType> typesCache = <Node, DartType>{};
110 Setlet<Node> _superUses; 114 Setlet<Node> _superUses;
111 Map<Node, ConstantExpression> _constants; 115 Map<Node, ConstantExpression> _constants;
112 Map<VariableElement, List<Node>> _potentiallyMutated; 116 Map<VariableElement, List<Node>> _potentiallyMutated;
113 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn; 117 Map<Node, Map<VariableElement, List<Node>>> _potentiallyMutatedIn;
114 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure; 118 Map<VariableElement, List<Node>> _potentiallyMutatedInClosure;
115 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn; 119 Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn;
116 Maplet<Send, SendStructure> _sendStructureMap; 120 Maplet<Send, SendStructure> _sendStructureMap;
121 Maplet<NewExpression, NewStructure> _newStructureMap;
117 bool containsTryStatement = false; 122 bool containsTryStatement = false;
118 123
119 /// Map from nodes to the targets they define. 124 /// Map from nodes to the targets they define.
120 Map<Node, JumpTarget> _definedTargets; 125 Map<Node, JumpTarget> _definedTargets;
121 126
122 /// Map from goto statements to their targets. 127 /// Map from goto statements to their targets.
123 Map<GotoStatement, JumpTarget> _usedTargets; 128 Map<GotoStatement, JumpTarget> _usedTargets;
124 129
125 /// Map from labels to their label definition. 130 /// Map from labels to their label definition.
126 Map<Label, LabelDefinition> _definedLabels; 131 Map<Label, LabelDefinition> _definedLabels;
(...skipping 19 matching lines...) Expand all
146 // assert(invariant(node, 151 // assert(invariant(node,
147 // getTreeElement(node) == element || 152 // getTreeElement(node) == element ||
148 // getTreeElement(node) == null, 153 // getTreeElement(node) == null,
149 // message: '${getTreeElement(node)}; $element')); 154 // message: '${getTreeElement(node)}; $element'));
150 155
151 setTreeElement(node, element); 156 setTreeElement(node, element);
152 } 157 }
153 158
154 operator [](Node node) => getTreeElement(node); 159 operator [](Node node) => getTreeElement(node);
155 160
156 SendStructure getSendStructure(Send send) { 161 SendStructure getSendStructure(Send node) {
157 if (_sendStructureMap == null) return null; 162 if (_sendStructureMap == null) return null;
158 return _sendStructureMap[send]; 163 return _sendStructureMap[node];
159 } 164 }
160 165
161 void setSendStructure(Send send, SendStructure sendStructure) { 166 void setSendStructure(Send node, SendStructure sendStructure) {
162 if (_sendStructureMap == null) { 167 if (_sendStructureMap == null) {
163 _sendStructureMap = new Maplet<Send, SendStructure>(); 168 _sendStructureMap = new Maplet<Send, SendStructure>();
164 } 169 }
165 _sendStructureMap[send] = sendStructure; 170 _sendStructureMap[node] = sendStructure;
171 }
172
173 NewStructure getNewStructure(NewExpression node) {
174 if (_newStructureMap == null) return null;
175 return _newStructureMap[node];
176 }
177
178 void setNewStructure(NewExpression node, NewStructure newStructure) {
179 if (_newStructureMap == null) {
180 _newStructureMap = new Maplet<NewExpression, NewStructure>();
181 }
182 _newStructureMap[node] = newStructure;
166 } 183 }
167 184
168 void setType(Node node, DartType type) { 185 void setType(Node node, DartType type) {
169 if (_types == null) { 186 if (_types == null) {
170 _types = new Maplet<Node, DartType>(); 187 _types = new Maplet<Node, DartType>();
171 } 188 }
172 _types[node] = type; 189 _types[node] = type;
173 } 190 }
174 191
175 DartType getType(Node node) => _types != null ? _types[node] : null; 192 DartType getType(Node node) => _types != null ? _types[node] : null;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 466 }
450 467
451 void setCurrentTypeMask(ForIn node, TypeMask mask) { 468 void setCurrentTypeMask(ForIn node, TypeMask mask) {
452 _setTypeMask(node.inToken, mask); 469 _setTypeMask(node.inToken, mask);
453 } 470 }
454 471
455 TypeMask getCurrentTypeMask(ForIn node) { 472 TypeMask getCurrentTypeMask(ForIn node) {
456 return _getTypeMask(node.inToken); 473 return _getTypeMask(node.inToken);
457 } 474 }
458 } 475 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/send_structure.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698