| 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 8017ba65f47139a2866f32c6084ffe7b5592055c..841da5537dd12b301610f92198d15efeb9210c96 100644
|
| --- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
|
| +++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
|
| @@ -67,6 +67,7 @@ class Builder implements cps_ir.Visitor<Node> {
|
| List<cps_ir.Continuation> safeForInlining = <cps_ir.Continuation>[];
|
|
|
| ExecutableElement currentElement;
|
| + cps_ir.Parameter thisParameter;
|
| cps_ir.Continuation returnContinuation;
|
|
|
| Builder parent;
|
| @@ -120,7 +121,10 @@ class Builder implements cps_ir.Visitor<Node> {
|
| /// referred to by [reference].
|
| /// This increments the reference count for the given variable, so the
|
| /// returned expression must be used in the tree.
|
| - VariableUse getVariableUse(cps_ir.Reference<cps_ir.Primitive> reference) {
|
| + Expression getVariableUse(cps_ir.Reference<cps_ir.Primitive> reference) {
|
| + if (reference.definition == thisParameter) {
|
| + return new This();
|
| + }
|
| Variable variable = getVariable(reference.definition);
|
| if (variable == null) {
|
| // Note: this may fail because you forgot to implement a visit-function
|
| @@ -170,6 +174,7 @@ class Builder implements cps_ir.Visitor<Node> {
|
|
|
| FunctionDefinition buildFunction(cps_ir.FunctionDefinition node) {
|
| currentElement = node.element;
|
| + thisParameter = node.thisParameter;
|
| List<Variable> parameters =
|
| node.parameters.map(addFunctionParameter).toList();
|
| Statement body;
|
| @@ -185,6 +190,7 @@ class Builder implements cps_ir.Visitor<Node> {
|
|
|
| ConstructorDefinition buildConstructor(cps_ir.ConstructorDefinition node) {
|
| currentElement = node.element;
|
| + thisParameter = node.thisParameter;
|
| List<Variable> parameters =
|
| node.parameters.map(addFunctionParameter).toList();
|
| List<Initializer> initializers;
|
| @@ -575,10 +581,6 @@ class Builder implements cps_ir.Visitor<Node> {
|
| return new Constant(node.expression);
|
| }
|
|
|
| - Expression visitThis(cps_ir.This node) {
|
| - return new This();
|
| - }
|
| -
|
| Expression visitReifyTypeVar(cps_ir.ReifyTypeVar node) {
|
| return new ReifyTypeVar(node.typeVariable);
|
| }
|
|
|