Index: pkg/compiler/lib/src/kernel/kernel_visitor.dart |
diff --git a/pkg/compiler/lib/src/kernel/kernel_visitor.dart b/pkg/compiler/lib/src/kernel/kernel_visitor.dart |
index 071309b71c9a5746ad66fec378a4d17a63dc7eab..68945d0f870701adb42ba9475129d6a62b30a556 100644 |
--- a/pkg/compiler/lib/src/kernel/kernel_visitor.dart |
+++ b/pkg/compiler/lib/src/kernel/kernel_visitor.dart |
@@ -198,6 +198,13 @@ class KernelVisitor extends Object |
final Map<CascadeReceiver, ir.VariableGet> cascadeReceivers = |
<CascadeReceiver, ir.VariableGet>{}; |
+ final Map<ir.Node, Element> nodeToElement = <ir.Node, Element>{}; |
+ |
+ ir.Node associate(ir.Node node, Element element) { |
+ nodeToElement[node] = element; |
+ return node; |
+ } |
+ |
bool isVoidContext = false; |
KernelVisitor(this.currentElement, this.elements, this.kernel); |
@@ -1911,11 +1918,13 @@ class KernelVisitor extends Object |
ir.VariableDeclaration getLocal(LocalElement local) { |
return locals.putIfAbsent(local, () { |
- return new ir.VariableDeclaration(local.name, |
- initializer: null, |
- type: typeToIrHack(local.type), |
- isFinal: local.isFinal, |
- isConst: local.isConst); |
+ return associate( |
+ new ir.VariableDeclaration(local.name, |
+ initializer: null, |
+ type: typeToIrHack(local.type), |
+ isFinal: local.isFinal, |
+ isConst: local.isConst), |
+ local); |
}); |
} |
@@ -1985,13 +1994,15 @@ class KernelVisitor extends Object |
} |
ir.Statement body = |
(bodyNode == null) ? null : buildStatementInBlock(bodyNode); |
- return new ir.FunctionNode(body, |
- asyncMarker: asyncMarker, |
- returnType: returnType, |
- typeParameters: typeParameters, |
- positionalParameters: positionalParameters, |
- namedParameters: namedParameters, |
- requiredParameterCount: requiredParameterCount); |
+ return associate( |
+ new ir.FunctionNode(body, |
+ asyncMarker: asyncMarker, |
+ returnType: returnType, |
+ typeParameters: typeParameters, |
+ positionalParameters: positionalParameters, |
+ namedParameters: namedParameters, |
+ requiredParameterCount: requiredParameterCount), |
+ function); |
} |
@override |