Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart |
| index e8f61d009c3b54fc390a098d0bfbc1c422e14394..16286c445e7b3a97347b94be5a200225da8cf9da 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart |
| @@ -135,6 +135,16 @@ class InvokeMethod extends Expression implements Invoke { |
| accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); |
| } |
| +class InvokeSuperMethod extends Expression implements Invoke { |
| + Expression receiver; |
|
asgerf
2014/06/26 07:44:40
There should be no receiver
|
| + final Selector selector; |
| + final List<Expression> arguments; |
| + |
| + InvokeSuperMethod(this.selector, this.arguments) ; |
| + |
| + accept(Visitor visitor) => visitor.visitInvokeSuperMethod(this); |
| +} |
| + |
| /** |
| * Call to a factory or generative constructor. |
| */ |
| @@ -422,6 +432,7 @@ abstract class ExpressionVisitor<E> { |
| E visitVariable(Variable node); |
| E visitInvokeStatic(InvokeStatic node); |
| E visitInvokeMethod(InvokeMethod node); |
| + E visitInvokeSuperMethod(InvokeSuperMethod node); |
| E visitInvokeConstructor(InvokeConstructor node); |
| E visitConcatenateStrings(ConcatenateStrings node); |
| E visitConstant(Constant node); |
| @@ -719,6 +730,20 @@ class Builder extends ir.Visitor<Node> { |
| } |
| } |
| + Statement visitInvokeSuperMethod(ir.InvokeSuperMethod node) { |
| + List<Expression> arguments = translateArguments(node.arguments); |
| + Expression invoke = new InvokeSuperMethod(node.selector, arguments); |
| + ir.Continuation cont = node.continuation.definition; |
| + if (cont == returnContinuation) { |
| + return new Return(invoke); |
| + } else { |
| + assert(cont.hasExactlyOneUse); |
| + assert(cont.parameters.length == 1); |
| + return buildContinuationAssignment(cont.parameters.single, invoke, |
| + () => visit(cont.body)); |
| + } |
| + } |
| + |
| Statement visitConcatenateStrings(ir.ConcatenateStrings node) { |
| List<Expression> arguments = translateArguments(node.arguments); |
| Expression concat = new ConcatenateStrings(arguments); |
| @@ -949,7 +974,7 @@ class StatementRewriter extends Visitor<Statement, Expression> { |
| /// Returns the redirect target of [label] or [label] itself if it should not |
| /// be redirected. |
| - Jump redirect(Break jump) { |
| + Jump redirect(Jump jump) { |
| Jump newJump = labelRedirects[jump.target]; |
| return newJump != null ? newJump : jump; |
| } |
| @@ -1013,6 +1038,13 @@ class StatementRewriter extends Visitor<Statement, Expression> { |
| return node; |
| } |
| + Expression visitInvokeSuperMethod(InvokeSuperMethod node) { |
| + for (int i = node.arguments.length - 1; i >= 0; --i) { |
| + node.arguments[i] = visitExpression(node.arguments[i]); |
| + } |
| + return node; |
| + } |
| + |
| Expression visitInvokeConstructor(InvokeConstructor node) { |
| for (int i = node.arguments.length - 1; i >= 0; --i) { |
| node.arguments[i] = visitExpression(node.arguments[i]); |
| @@ -1066,12 +1098,12 @@ class StatementRewriter extends Visitor<Statement, Expression> { |
| // Redirect through chain of breaks. |
| // Note that useCount was accounted for at visitLabeledStatement. |
| // Note redirect may return either a Break or Continue statement. |
| - node = redirect(node); |
| - if (node is Break && node.target.useCount == 1) { |
| - --node.target.useCount; |
| - return visitStatement(node.target.binding.next); |
| + Jump jump = redirect(node); |
| + if (jump is Break && jump.target.useCount == 1) { |
| + --jump.target.useCount; |
| + return visitStatement(jump.target.binding.next); |
| } |
| - return node; |
| + return jump; |
| } |
| Statement visitContinue(Continue node) { |
| @@ -1655,6 +1687,11 @@ class LogicalRewriter extends Visitor<Statement, Expression> { |
| return node; |
| } |
| + Expression visitInvokeSuperMethod(InvokeSuperMethod node) { |
| + _rewriteList(node.arguments); |
| + return node; |
| + } |
| + |
| Expression visitInvokeConstructor(InvokeConstructor node) { |
| _rewriteList(node.arguments); |
| return node; |