Chromium Code Reviews| 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 print("${selector.kind} ${arguments};"); | |
|
asgerf
2014/06/27 08:09:56
Stray print call.
sigurdm
2014/06/27 09:20:21
Done.
| |
| 195 assert(selector.kind == SelectorKind.CALL || | |
| 196 selector.kind == SelectorKind.OPERATOR || | |
| 197 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) || | |
| 198 (selector.kind == SelectorKind.SETTER && arguments.length == 1) || | |
| 199 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || | |
| 200 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); | |
| 201 } | |
| 202 | |
| 203 accept(Visitor visitor) => visitor.visitInvokeSuperMethod(this); | |
| 204 } | |
| 205 | |
| 181 /// Non-const call to a constructor. The [target] may be a generative | 206 /// Non-const call to a constructor. The [target] may be a generative |
| 182 /// constructor, factory, or redirecting factory. | 207 /// constructor, factory, or redirecting factory. |
| 183 class InvokeConstructor extends Expression implements Invoke { | 208 class InvokeConstructor extends Expression implements Invoke { |
| 184 final GenericType type; | 209 final GenericType type; |
| 185 final FunctionElement target; | 210 final FunctionElement target; |
| 186 final Reference continuation; | 211 final Reference continuation; |
| 187 final List<Reference> arguments; | 212 final List<Reference> arguments; |
| 188 final Selector selector; | 213 final Selector selector; |
| 189 | 214 |
| 190 /// The class being instantiated. This is the same as `target.enclosingClass` | 215 /// 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 | 418 |
| 394 // Concrete classes. | 419 // Concrete classes. |
| 395 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node); | 420 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node); |
| 396 | 421 |
| 397 // Expressions. | 422 // Expressions. |
| 398 T visitLetPrim(LetPrim node) => visitExpression(node); | 423 T visitLetPrim(LetPrim node) => visitExpression(node); |
| 399 T visitLetCont(LetCont node) => visitExpression(node); | 424 T visitLetCont(LetCont node) => visitExpression(node); |
| 400 T visitInvokeStatic(InvokeStatic node) => visitExpression(node); | 425 T visitInvokeStatic(InvokeStatic node) => visitExpression(node); |
| 401 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node); | 426 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node); |
| 402 T visitInvokeMethod(InvokeMethod node) => visitExpression(node); | 427 T visitInvokeMethod(InvokeMethod node) => visitExpression(node); |
| 428 T visitInvokeSuperMethod(InvokeSuperMethod node) => visitExpression(node); | |
| 403 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node); | 429 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node); |
| 404 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node); | 430 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node); |
| 405 T visitBranch(Branch node) => visitExpression(node); | 431 T visitBranch(Branch node) => visitExpression(node); |
| 406 T visitAsCast(AsCast node) => visitExpression(node); | 432 T visitAsCast(AsCast node) => visitExpression(node); |
| 407 | 433 |
| 408 // Definitions. | 434 // Definitions. |
| 409 T visitLiteralList(LiteralList node) => visitPrimitive(node); | 435 T visitLiteralList(LiteralList node) => visitPrimitive(node); |
| 410 T visitLiteralMap(LiteralMap node) => visitPrimitive(node); | 436 T visitLiteralMap(LiteralMap node) => visitPrimitive(node); |
| 411 T visitIsCheck(IsCheck node) => visitPrimitive(node); | 437 T visitIsCheck(IsCheck node) => visitPrimitive(node); |
| 412 T visitConstant(Constant node) => visitPrimitive(node); | 438 T visitConstant(Constant node) => visitPrimitive(node); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 | 668 |
| 643 void visitInvokeContinuation(InvokeContinuation node) { | 669 void visitInvokeContinuation(InvokeContinuation node) { |
| 644 node.arguments.forEach(visitReference); | 670 node.arguments.forEach(visitReference); |
| 645 } | 671 } |
| 646 | 672 |
| 647 void visitInvokeMethod(InvokeMethod node) { | 673 void visitInvokeMethod(InvokeMethod node) { |
| 648 visitReference(node.receiver); | 674 visitReference(node.receiver); |
| 649 node.arguments.forEach(visitReference); | 675 node.arguments.forEach(visitReference); |
| 650 } | 676 } |
| 651 | 677 |
| 678 void visitInvokeSuperMethod(InvokeSuperMethod node) { | |
| 679 node.arguments.forEach(visitReference); | |
| 680 } | |
| 681 | |
| 652 void visitInvokeConstructor(InvokeConstructor node) { | 682 void visitInvokeConstructor(InvokeConstructor node) { |
| 653 node.arguments.forEach(visitReference); | 683 node.arguments.forEach(visitReference); |
| 654 } | 684 } |
| 655 | 685 |
| 656 void visitConcatenateStrings(ConcatenateStrings node) { | 686 void visitConcatenateStrings(ConcatenateStrings node) { |
| 657 node.arguments.forEach(visitReference); | 687 node.arguments.forEach(visitReference); |
| 658 } | 688 } |
| 659 | 689 |
| 660 void visitBranch(Branch node) { | 690 void visitBranch(Branch node) { |
| 661 visit(node.condition); | 691 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) { | 728 for (int i = node.parameters.length - 1; i >= 0; --i) { |
| 699 release(node.parameters[i]); | 729 release(node.parameters[i]); |
| 700 } | 730 } |
| 701 } | 731 } |
| 702 | 732 |
| 703 void visitIsTrue(IsTrue node) { | 733 void visitIsTrue(IsTrue node) { |
| 704 visitReference(node.value); | 734 visitReference(node.value); |
| 705 } | 735 } |
| 706 | 736 |
| 707 } | 737 } |
| OLD | NEW |