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

Unified 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: Long line. 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/resolution/tree_elements.dart
diff --git a/pkg/compiler/lib/src/resolution/tree_elements.dart b/pkg/compiler/lib/src/resolution/tree_elements.dart
index cef3c2ad8a772af7fc6eb44aa5f13ae33cdb10f4..e04b537255ba7fbbfc5cd0c9c6448a86ee949fcf 100644
--- a/pkg/compiler/lib/src/resolution/tree_elements.dart
+++ b/pkg/compiler/lib/src/resolution/tree_elements.dart
@@ -29,7 +29,11 @@ abstract class TreeElements {
Element operator[](Node node);
Map<Node, DartType> get typesCache;
- SendStructure getSendStructure(Send send);
+ /// Returns the [SendStructure] that describes the semantics of [node].
+ SendStructure getSendStructure(Send node);
+
+ /// Returns the [NewStructure] that describes the semantics of [node].
+ NewStructure getNewStructure(NewExpression node);
// TODO(johnniwinther): Investigate whether [Node] could be a [Send].
Selector getSelector(Node node);
@@ -114,6 +118,7 @@ class TreeElementMapping extends TreeElements {
Map<VariableElement, List<Node>> _potentiallyMutatedInClosure;
Map<Node, Map<VariableElement, List<Node>>> _accessedByClosureIn;
Maplet<Send, SendStructure> _sendStructureMap;
+ Maplet<NewExpression, NewStructure> _newStructureMap;
bool containsTryStatement = false;
/// Map from nodes to the targets they define.
@@ -153,16 +158,28 @@ class TreeElementMapping extends TreeElements {
operator [](Node node) => getTreeElement(node);
- SendStructure getSendStructure(Send send) {
+ SendStructure getSendStructure(Send node) {
if (_sendStructureMap == null) return null;
- return _sendStructureMap[send];
+ return _sendStructureMap[node];
}
- void setSendStructure(Send send, SendStructure sendStructure) {
+ void setSendStructure(Send node, SendStructure sendStructure) {
if (_sendStructureMap == null) {
_sendStructureMap = new Maplet<Send, SendStructure>();
}
- _sendStructureMap[send] = sendStructure;
+ _sendStructureMap[node] = sendStructure;
+ }
+
+ NewStructure getNewStructure(NewExpression node) {
+ if (_newStructureMap == null) return null;
+ return _newStructureMap[node];
+ }
+
+ void setNewStructure(NewExpression node, NewStructure newStructure) {
+ if (_newStructureMap == null) {
+ _newStructureMap = new Maplet<NewExpression, NewStructure>();
+ }
+ _newStructureMap[node] = newStructure;
}
void setType(Node node, DartType type) {

Powered by Google App Engine
This is Rietveld 408576698