| 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 4c614c977ef00e8f1f3f49bf17a7089f411071f4..6a9a3240cf17d83c3057a55db52b6da7fed92493 100644
|
| --- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
|
| +++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
|
| @@ -112,17 +112,20 @@ class Builder extends cps_ir.Visitor<Node> {
|
| ExecutableDefinition build(cps_ir.ExecutableDefinition node) {
|
| if (node is cps_ir.FieldDefinition) {
|
| return buildField(node);
|
| + } else if (node is cps_ir.ConstructorDefinition) {
|
| + return buildConstructor(node);
|
| } else if (node is cps_ir.FunctionDefinition) {
|
| return buildFunction(node);
|
| }
|
| assert(false);
|
| + return null;
|
| }
|
|
|
| FieldDefinition buildField(cps_ir.FieldDefinition node) {
|
| Statement body;
|
| if (node.hasInitializer) {
|
| currentElement = node.element;
|
| - returnContinuation = node.returnContinuation;
|
| + returnContinuation = node.body.returnContinuation;
|
|
|
| phiTempVar = new Variable(node.element, null);
|
|
|
| @@ -148,10 +151,10 @@ class Builder extends cps_ir.Visitor<Node> {
|
| ++parameter.writeCount; // Being a parameter counts as a write.
|
| parameters.add(parameter);
|
| }
|
| - returnContinuation = node.returnContinuation;
|
|
|
| Statement body;
|
| if (!node.isAbstract) {
|
| + returnContinuation = node.body.returnContinuation;
|
| phiTempVar = new Variable(node.element, null);
|
| body = visit(node.body);
|
| }
|
| @@ -160,6 +163,31 @@ class Builder extends cps_ir.Visitor<Node> {
|
| body, node.localConstants, node.defaultParameterValues);
|
| }
|
|
|
| + ConstructorDefinition buildConstructor(cps_ir.ConstructorDefinition node) {
|
| + currentElement = node.element;
|
| + List<Variable> parameters = <Variable>[];
|
| + for (cps_ir.Definition p in node.parameters) {
|
| + Variable parameter = getFunctionParameter(p);
|
| + assert(parameter != null);
|
| + ++parameter.writeCount; // Being a parameter counts as a write.
|
| + parameters.add(parameter);
|
| + }
|
| + List<Initializer> initializers;
|
| + Statement body;
|
| + if (!node.isAbstract) {
|
| + initializers = node.initializers.map(visit).toList();
|
| + returnContinuation = node.body.returnContinuation;
|
| +
|
| + phiTempVar = new Variable(node.element, null);
|
| + body = visit(node.body);
|
| + }
|
| +
|
| + return new ConstructorDefinition(node.element, parameters,
|
| + body, initializers, node.localConstants, node.defaultParameterValues,
|
| + node.isConst);
|
| + }
|
| +
|
| +
|
| List<Expression> translateArguments(List<cps_ir.Reference> args) {
|
| return new List<Expression>.generate(args.length,
|
| (int index) => getVariableReference(args[index]));
|
| @@ -271,6 +299,20 @@ class Builder extends cps_ir.Visitor<Node> {
|
|
|
| visitNode(cps_ir.Node node) => throw "Unhandled node: $node";
|
|
|
| + Initializer visitFieldInitializer(cps_ir.FieldInitializer node) {
|
| + returnContinuation = node.body.returnContinuation;
|
| + return new FieldInitializer(node.element, visit(node.body.body));
|
| + }
|
| +
|
| + Initializer visitSuperInitializer(cps_ir.SuperInitializer node) {
|
| + List<Statement> arguments =
|
| + node.arguments.map((cps_ir.RunnableBody argument) {
|
| + returnContinuation = argument.returnContinuation;
|
| + return visit(argument.body);
|
| + }).toList();
|
| + return new SuperInitializer(node.target, node.selector, arguments);
|
| + }
|
| +
|
| Statement visitLetPrim(cps_ir.LetPrim node) {
|
| Variable variable = getVariable(node.primitive);
|
|
|
| @@ -289,6 +331,10 @@ class Builder extends cps_ir.Visitor<Node> {
|
| }
|
| }
|
|
|
| + Statement visitRunnableBody(cps_ir.RunnableBody node) {
|
| + return visit(node.body);
|
| + }
|
| +
|
| Statement visitLetCont(cps_ir.LetCont node) {
|
| Label label;
|
| if (node.continuation.hasMultipleUses) {
|
|
|