| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |