Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ir/ir_nodes.dart

Issue 349923004: Add support for superSend to the new IR and dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also handle implicit this, fix a typeerror. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 import '../elements/elements.dart' 10 import '../elements/elements.dart'
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 selector.kind == SelectorKind.OPERATOR || 174 selector.kind == SelectorKind.OPERATOR ||
175 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) || 175 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) ||
176 (selector.kind == SelectorKind.SETTER && arguments.length == 1) || 176 (selector.kind == SelectorKind.SETTER && arguments.length == 1) ||
177 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || 177 (selector.kind == SelectorKind.INDEX && arguments.length == 1) ||
178 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); 178 (selector.kind == SelectorKind.INDEX && arguments.length == 2));
179 } 179 }
180 180
181 accept(Visitor visitor) => visitor.visitInvokeMethod(this); 181 accept(Visitor visitor) => visitor.visitInvokeMethod(this);
182 } 182 }
183 183
184 /// Invoke a method, operator, getter, setter, or index getter/setter from the
185 /// super class in tail position.
186 class InvokeSuperMethod extends Expression implements Invoke {
187 final Selector selector;
188 final Reference continuation;
189 final List<Reference> arguments;
190
191 InvokeSuperMethod(this.selector,
192 Continuation cont,
193 List<Definition> args)
194 : continuation = new Reference(cont),
195 arguments = _referenceList(args) {
196 assert(selector != null);
197 assert(selector.kind == SelectorKind.CALL ||
198 selector.kind == SelectorKind.OPERATOR ||
199 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) ||
200 (selector.kind == SelectorKind.SETTER && arguments.length == 1) ||
201 (selector.kind == SelectorKind.INDEX && arguments.length == 1) ||
202 (selector.kind == SelectorKind.INDEX && arguments.length == 2));
203 }
204
205 accept(Visitor visitor) => visitor.visitInvokeSuperMethod(this);
206 }
207
184 /// Non-const call to a constructor. The [target] may be a generative 208 /// Non-const call to a constructor. The [target] may be a generative
185 /// constructor, factory, or redirecting factory. 209 /// constructor, factory, or redirecting factory.
186 class InvokeConstructor extends Expression implements Invoke { 210 class InvokeConstructor extends Expression implements Invoke {
187 final GenericType type; 211 final GenericType type;
188 final FunctionElement target; 212 final FunctionElement target;
189 final Reference continuation; 213 final Reference continuation;
190 final List<Reference> arguments; 214 final List<Reference> arguments;
191 final Selector selector; 215 final Selector selector;
192 216
193 /// The class being instantiated. This is the same as `target.enclosingClass` 217 /// The class being instantiated. This is the same as `target.enclosingClass`
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 423
400 // Concrete classes. 424 // Concrete classes.
401 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node); 425 T visitFunctionDefinition(FunctionDefinition node) => visitNode(node);
402 426
403 // Expressions. 427 // Expressions.
404 T visitLetPrim(LetPrim node) => visitExpression(node); 428 T visitLetPrim(LetPrim node) => visitExpression(node);
405 T visitLetCont(LetCont node) => visitExpression(node); 429 T visitLetCont(LetCont node) => visitExpression(node);
406 T visitInvokeStatic(InvokeStatic node) => visitExpression(node); 430 T visitInvokeStatic(InvokeStatic node) => visitExpression(node);
407 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node); 431 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node);
408 T visitInvokeMethod(InvokeMethod node) => visitExpression(node); 432 T visitInvokeMethod(InvokeMethod node) => visitExpression(node);
433 T visitInvokeSuperMethod(InvokeSuperMethod node) => visitExpression(node);
409 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node); 434 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node);
410 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node); 435 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node);
411 T visitBranch(Branch node) => visitExpression(node); 436 T visitBranch(Branch node) => visitExpression(node);
412 437
413 // Definitions. 438 // Definitions.
414 T visitLiteralList(LiteralList node) => visitPrimitive(node); 439 T visitLiteralList(LiteralList node) => visitPrimitive(node);
415 T visitLiteralMap(LiteralMap node) => visitPrimitive(node); 440 T visitLiteralMap(LiteralMap node) => visitPrimitive(node);
416 T visitConstant(Constant node) => visitPrimitive(node); 441 T visitConstant(Constant node) => visitPrimitive(node);
417 T visitThis(This node) => visitPrimitive(node); 442 T visitThis(This node) => visitPrimitive(node);
418 T visitInvokeConstConstructor(InvokeConstConstructor node) => visitPrimitive(n ode); 443 T visitInvokeConstConstructor(InvokeConstConstructor node) => visitPrimitive(n ode);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 658
634 void visitInvokeContinuation(InvokeContinuation node) { 659 void visitInvokeContinuation(InvokeContinuation node) {
635 node.arguments.forEach(visitReference); 660 node.arguments.forEach(visitReference);
636 } 661 }
637 662
638 void visitInvokeMethod(InvokeMethod node) { 663 void visitInvokeMethod(InvokeMethod node) {
639 visitReference(node.receiver); 664 visitReference(node.receiver);
640 node.arguments.forEach(visitReference); 665 node.arguments.forEach(visitReference);
641 } 666 }
642 667
668 void visitInvokeSuperMethod(InvokeSuperMethod node) {
669 node.arguments.forEach(visitReference);
670 }
671
643 void visitInvokeConstructor(InvokeConstructor node) { 672 void visitInvokeConstructor(InvokeConstructor node) {
644 node.arguments.forEach(visitReference); 673 node.arguments.forEach(visitReference);
645 } 674 }
646 675
647 void visitConcatenateStrings(ConcatenateStrings node) { 676 void visitConcatenateStrings(ConcatenateStrings node) {
648 node.arguments.forEach(visitReference); 677 node.arguments.forEach(visitReference);
649 } 678 }
650 679
651 void visitBranch(Branch node) { 680 void visitBranch(Branch node) {
652 visit(node.condition); 681 visit(node.condition);
(...skipping 30 matching lines...) Expand all
683 for (int i = node.parameters.length - 1; i >= 0; --i) { 712 for (int i = node.parameters.length - 1; i >= 0; --i) {
684 release(node.parameters[i]); 713 release(node.parameters[i]);
685 } 714 }
686 } 715 }
687 716
688 void visitIsTrue(IsTrue node) { 717 void visitIsTrue(IsTrue node) {
689 visitReference(node.value); 718 visitReference(node.value);
690 } 719 }
691 720
692 } 721 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698