Index: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
index f9f35de3fe4f87437e11cf7c01a9fc89e7e3d409..b482a319aea579a128e1f58d5c0179f4a86c5854 100644 |
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart |
@@ -267,15 +267,37 @@ class Builder implements cps_ir.Visitor<Node> { |
internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node'); |
} |
- // JS-specific nodes are handled by a subclass. |
- visitSetField(cps_ir.SetField node) => unexpectedNode(node); |
- visitIdentical(cps_ir.Identical node) => unexpectedNode(node); |
- visitInterceptor(cps_ir.Interceptor node) => unexpectedNode(node); |
- visitCreateInstance(cps_ir.CreateInstance node) => unexpectedNode(node); |
- visitGetField(cps_ir.GetField node) => unexpectedNode(node); |
- visitCreateBox(cps_ir.CreateBox node) => unexpectedNode(node); |
+ Statement visitSetField(cps_ir.SetField node) { |
+ return new ExpressionStatement( |
+ new SetField(getVariableUse(node.object), |
+ node.field, |
+ getVariableUse(node.value)), |
+ visit(node.body)); |
+ } |
+ |
+ Expression visitInterceptor(cps_ir.Interceptor node) { |
+ return new Interceptor(getVariableUse(node.input), node.interceptedClasses); |
+ } |
+ |
+ Expression visitCreateInstance(cps_ir.CreateInstance node) { |
+ return new CreateInstance( |
+ node.classElement, |
+ translateArguments(node.arguments), |
+ translateArguments(node.typeInformation)); |
+ } |
+ |
+ Expression visitGetField(cps_ir.GetField node) { |
+ return new GetField(getVariableUse(node.object), node.field); |
+ } |
+ |
+ Expression visitCreateBox(cps_ir.CreateBox node) { |
+ return new CreateBox(); |
+ } |
+ |
visitCreateInvocationMirror(cps_ir.CreateInvocationMirror node) { |
- return unexpectedNode(node); |
+ return new CreateInvocationMirror( |
+ node.selector, |
+ translateArguments(node.arguments)); |
} |
// Executable definitions are not visited directly. They have 'build' |
@@ -586,9 +608,24 @@ class Builder implements cps_ir.Visitor<Node> { |
translateArguments(node.arguments)); |
} |
- @override |
- visitForeignCode(cps_ir.ForeignCode node) { |
- unexpectedNode(node); |
+ Statement visitForeignCode(cps_ir.ForeignCode node) { |
+ if (node.codeTemplate.isExpression) { |
+ Expression foreignCode = new ForeignExpression( |
+ node.codeTemplate, |
+ node.type, |
+ node.arguments.map(getVariableUse).toList(growable: false), |
+ node.nativeBehavior, |
+ node.dependency); |
+ return continueWithExpression(node.continuation, foreignCode); |
+ } else { |
+ assert(node.continuation == null); |
+ return new ForeignStatement( |
+ node.codeTemplate, |
+ node.type, |
+ node.arguments.map(getVariableUse).toList(growable: false), |
+ node.nativeBehavior, |
+ node.dependency); |
+ } |
} |
} |