| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // IrNodes are kept in a separate library to have precise control over their | 5 // IrNodes are kept in a separate library to have precise control over their |
| 6 // dependencies on other parts of the system. | 6 // dependencies on other parts of the system. |
| 7 library dart2js.ir_nodes; | 7 library dart2js.ir_nodes; |
| 8 | 8 |
| 9 import '../dart2jslib.dart' as dart2js show Constant, ConstructedConstant, | 9 import '../dart2jslib.dart' as dart2js show Constant, ConstructedConstant, |
| 10 StringConstant, ListConstant, MapConstant; | 10 StringConstant, ListConstant, MapConstant; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 selector.kind == SelectorKind.OPERATOR || | 171 selector.kind == SelectorKind.OPERATOR || |
| 172 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) || | 172 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) || |
| 173 (selector.kind == SelectorKind.SETTER && arguments.length == 1) || | 173 (selector.kind == SelectorKind.SETTER && arguments.length == 1) || |
| 174 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || | 174 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || |
| 175 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); | 175 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 accept(Visitor visitor) => visitor.visitInvokeMethod(this); | 178 accept(Visitor visitor) => visitor.visitInvokeMethod(this); |
| 179 } | 179 } |
| 180 | 180 |
| 181 /// Invoke a method, operator, getter, setter, or index getter/setter from the |
| 182 /// super class in tail position. |
| 183 class InvokeSuperMethod extends Expression implements Invoke { |
| 184 final Selector selector; |
| 185 final Reference continuation; |
| 186 final List<Reference> arguments; |
| 187 |
| 188 InvokeSuperMethod(this.selector, |
| 189 Continuation cont, |
| 190 List<Definition> args) |
| 191 : continuation = new Reference(cont), |
| 192 arguments = _referenceList(args) { |
| 193 assert(selector != null); |
| 194 assert(selector.kind == SelectorKind.CALL || |
| 195 selector.kind == SelectorKind.OPERATOR || |
| 196 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) || |
| 197 (selector.kind == SelectorKind.SETTER && arguments.length == 1) || |
| 198 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || |
| 199 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); |
| 200 } |
| 201 |
| 202 accept(Visitor visitor) => visitor.visitInvokeSuperMethod(this); |
| 203 } |
| 204 |
| 181 /// Non-const call to a constructor. The [target] may be a generative | 205 /// Non-const call to a constructor. The [target] may be a generative |
| 182 /// constructor, factory, or redirecting factory. | 206 /// constructor, factory, or redirecting factory. |
| 183 class InvokeConstructor extends Expression implements Invoke { | 207 class InvokeConstructor extends Expression implements Invoke { |
| 184 final GenericType type; | 208 final GenericType type; |
| 185 final FunctionElement target; | 209 final FunctionElement target; |
| 186 final Reference continuation; | 210 final Reference continuation; |
| 187 final List<Reference> arguments; | 211 final List<Reference> arguments; |
| 188 final Selector selector; | 212 final Selector selector; |
| 189 | 213 |
| 190 /// The class being instantiated. This is the same as `target.enclosingClass` | 214 /// The class being instantiated. This is the same as `target.enclosingClass` |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 417 |
| 394 // Concrete classes. | 418 // Concrete classes. |
| 395 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node); | 419 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node); |
| 396 | 420 |
| 397 // Expressions. | 421 // Expressions. |
| 398 T visitLetPrim(LetPrim node) => visitExpression(node); | 422 T visitLetPrim(LetPrim node) => visitExpression(node); |
| 399 T visitLetCont(LetCont node) => visitExpression(node); | 423 T visitLetCont(LetCont node) => visitExpression(node); |
| 400 T visitInvokeStatic(InvokeStatic node) => visitExpression(node); | 424 T visitInvokeStatic(InvokeStatic node) => visitExpression(node); |
| 401 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node); | 425 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node); |
| 402 T visitInvokeMethod(InvokeMethod node) => visitExpression(node); | 426 T visitInvokeMethod(InvokeMethod node) => visitExpression(node); |
| 427 T visitInvokeSuperMethod(InvokeSuperMethod node) => visitExpression(node); |
| 403 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node); | 428 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node); |
| 404 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node); | 429 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node); |
| 405 T visitBranch(Branch node) => visitExpression(node); | 430 T visitBranch(Branch node) => visitExpression(node); |
| 406 T visitAsCast(AsCast node) => visitExpression(node); | 431 T visitAsCast(AsCast node) => visitExpression(node); |
| 407 | 432 |
| 408 // Definitions. | 433 // Definitions. |
| 409 T visitLiteralList(LiteralList node) => visitPrimitive(node); | 434 T visitLiteralList(LiteralList node) => visitPrimitive(node); |
| 410 T visitLiteralMap(LiteralMap node) => visitPrimitive(node); | 435 T visitLiteralMap(LiteralMap node) => visitPrimitive(node); |
| 411 T visitIsCheck(IsCheck node) => visitPrimitive(node); | 436 T visitIsCheck(IsCheck node) => visitPrimitive(node); |
| 412 T visitConstant(Constant node) => visitPrimitive(node); | 437 T visitConstant(Constant node) => visitPrimitive(node); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 | 667 |
| 643 void visitInvokeContinuation(InvokeContinuation node) { | 668 void visitInvokeContinuation(InvokeContinuation node) { |
| 644 node.arguments.forEach(visitReference); | 669 node.arguments.forEach(visitReference); |
| 645 } | 670 } |
| 646 | 671 |
| 647 void visitInvokeMethod(InvokeMethod node) { | 672 void visitInvokeMethod(InvokeMethod node) { |
| 648 visitReference(node.receiver); | 673 visitReference(node.receiver); |
| 649 node.arguments.forEach(visitReference); | 674 node.arguments.forEach(visitReference); |
| 650 } | 675 } |
| 651 | 676 |
| 677 void visitInvokeSuperMethod(InvokeSuperMethod node) { |
| 678 node.arguments.forEach(visitReference); |
| 679 } |
| 680 |
| 652 void visitInvokeConstructor(InvokeConstructor node) { | 681 void visitInvokeConstructor(InvokeConstructor node) { |
| 653 node.arguments.forEach(visitReference); | 682 node.arguments.forEach(visitReference); |
| 654 } | 683 } |
| 655 | 684 |
| 656 void visitConcatenateStrings(ConcatenateStrings node) { | 685 void visitConcatenateStrings(ConcatenateStrings node) { |
| 657 node.arguments.forEach(visitReference); | 686 node.arguments.forEach(visitReference); |
| 658 } | 687 } |
| 659 | 688 |
| 660 void visitBranch(Branch node) { | 689 void visitBranch(Branch node) { |
| 661 visit(node.condition); | 690 visit(node.condition); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 for (int i = node.parameters.length - 1; i >= 0; --i) { | 727 for (int i = node.parameters.length - 1; i >= 0; --i) { |
| 699 release(node.parameters[i]); | 728 release(node.parameters[i]); |
| 700 } | 729 } |
| 701 } | 730 } |
| 702 | 731 |
| 703 void visitIsTrue(IsTrue node) { | 732 void visitIsTrue(IsTrue node) { |
| 704 visitReference(node.value); | 733 visitReference(node.value); |
| 705 } | 734 } |
| 706 | 735 |
| 707 } | 736 } |
| OLD | NEW |