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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1418573011: dart2js: Change how super tear-offs are registered. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix Created 5 years, 1 month 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
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 code_generator; 5 library code_generator;
6 6
7 import 'glue.dart'; 7 import 'glue.dart';
8 8
9 import '../../closure.dart' show 9 import '../../closure.dart' show
10 ClosureClassElement; 10 ClosureClassElement;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 @override 300 @override
301 js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) { 301 js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) {
302 FunctionElement target = node.target; 302 FunctionElement target = node.target;
303 List<js.Expression> arguments = visitExpressionList(node.arguments); 303 List<js.Expression> arguments = visitExpressionList(node.arguments);
304 return buildStaticInvoke(target, arguments, 304 return buildStaticInvoke(target, arguments,
305 sourceInformation: node.sourceInformation); 305 sourceInformation: node.sourceInformation);
306 } 306 }
307 307
308 @override 308 @override
309 js.Expression visitInvokeMethodDirectly(tree_ir.InvokeMethodDirectly node) { 309 js.Expression visitInvokeMethodDirectly(tree_ir.InvokeMethodDirectly node) {
310 if (node.isTearOff) {
311 // If this is a tear-off, register the fact that a tear-off closure
312 // will be created, and that this tear-off must bypass ordinary
313 // dispatch to ensure the super method is invoked.
314 registry.registerStaticUse(new StaticUse.staticInvoke(
315 glue.closureFromTearOff, new CallStructure.unnamed(
316 glue.closureFromTearOff.parameters.length)));
317 registry.registerStaticUse(new StaticUse.superTearOff(node.target));
318 }
310 if (node.target is ConstructorBodyElement) { 319 if (node.target is ConstructorBodyElement) {
311 registry.registerStaticUse( 320 registry.registerStaticUse(
312 new StaticUse.constructorBodyInvoke( 321 new StaticUse.constructorBodyInvoke(
313 node.target.declaration, 322 node.target.declaration,
314 new CallStructure.unnamed(node.arguments.length))); 323 new CallStructure.unnamed(node.arguments.length)));
315 // A constructor body cannot be overriden or intercepted, so we can 324 // A constructor body cannot be overriden or intercepted, so we can
316 // use the short form for this invocation. 325 // use the short form for this invocation.
317 return js.js('#.#(#)', 326 return js.js('#.#(#)',
318 [visitExpression(node.receiver), 327 [visitExpression(node.receiver),
319 glue.instanceMethodName(node.target), 328 glue.instanceMethodName(node.target),
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 void registerDefaultParameterValues(ExecutableElement element) { 1089 void registerDefaultParameterValues(ExecutableElement element) {
1081 if (element is! FunctionElement) return; 1090 if (element is! FunctionElement) return;
1082 FunctionElement function = element; 1091 FunctionElement function = element;
1083 if (function.isStatic) return; // Defaults are inlined at call sites. 1092 if (function.isStatic) return; // Defaults are inlined at call sites.
1084 function.functionSignature.forEachOptionalParameter((param) { 1093 function.functionSignature.forEachOptionalParameter((param) {
1085 ConstantValue constant = glue.getDefaultParameterValue(param); 1094 ConstantValue constant = glue.getDefaultParameterValue(param);
1086 registry.registerCompileTimeConstant(constant); 1095 registry.registerCompileTimeConstant(constant);
1087 }); 1096 });
1088 } 1097 }
1089 } 1098 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend_helpers.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698