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

Unified Diff: pkg/compiler/lib/src/kernel/kernel_visitor.dart

Issue 2268893006: record originating elements for Kernel nodes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698