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

Side by Side Diff: pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart

Issue 861713002: Handle super-method invocations in CPS->JS backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library backend_ast_emitter; 5 library backend_ast_emitter;
6 6
7 import '../tree_ir/tree_ir_nodes.dart' as tree; 7 import '../tree_ir/tree_ir_nodes.dart' as tree;
8 import 'backend_ast_nodes.dart'; 8 import 'backend_ast_nodes.dart';
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 770 }
771 771
772 @override 772 @override
773 Expression visitInvokeMethod(tree.InvokeMethod exp, 773 Expression visitInvokeMethod(tree.InvokeMethod exp,
774 BuilderContext<Statement> context) { 774 BuilderContext<Statement> context) {
775 Expression receiver = visitExpression(exp.receiver, context); 775 Expression receiver = visitExpression(exp.receiver, context);
776 return emitMethodCall(exp, receiver, context); 776 return emitMethodCall(exp, receiver, context);
777 } 777 }
778 778
779 @override 779 @override
780 Expression visitInvokeSuperMethod(tree.InvokeSuperMethod exp, 780 Expression visitInvokeMethodDirectly(tree.InvokeMethodDirectly exp,
781 BuilderContext<Statement> context) { 781 BuilderContext<Statement> context) {
782 // When targeting Dart, InvokeMethodDirectly is only used for super calls.
783 // The receiver is known to be `this`, and the target method is a method
784 // on the super class. So we just translate it as a method call with the
785 // super receiver.
sigurdm 2015/01/20 10:54:25 Perhaps put asserts here that the invariant is mai
asgerf 2015/01/20 13:07:50 Unfortunately there is no good way to do that. If
782 return emitMethodCall(exp, new SuperReceiver(), context); 786 return emitMethodCall(exp, new SuperReceiver(), context);
783 } 787 }
784 788
785 @override 789 @override
786 Expression visitInvokeConstructor(tree.InvokeConstructor exp, 790 Expression visitInvokeConstructor(tree.InvokeConstructor exp,
787 BuilderContext<Statement> context) { 791 BuilderContext<Statement> context) {
788 List<Argument> args = 792 List<Argument> args =
789 emitArguments(visitArgumentList(exp.arguments, context), exp.selector); 793 emitArguments(visitArgumentList(exp.arguments, context), exp.selector);
790 FunctionElement constructor = exp.target; 794 FunctionElement constructor = exp.target;
791 String name = constructor.name.isEmpty ? null : constructor.name; 795 String name = constructor.name.isEmpty ? null : constructor.name;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null); 1258 : super(name, ElementKind.VARIABLE, enclosingElement, variables, null);
1255 1259
1256 ExecutableElement get executableContext => enclosingElement; 1260 ExecutableElement get executableContext => enclosingElement;
1257 1261
1258 ExecutableElement get memberContext => executableContext.memberContext; 1262 ExecutableElement get memberContext => executableContext.memberContext;
1259 1263
1260 bool get isLocal => true; 1264 bool get isLocal => true;
1261 1265
1262 LibraryElement get implementationLibrary => enclosingElement.library; 1266 LibraryElement get implementationLibrary => enclosingElement.library;
1263 } 1267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698