Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1255 mangledFieldNames[getter] = name; | 1255 mangledFieldNames[getter] = name; |
| 1256 recordedMangledNames.add(getter); | 1256 recordedMangledNames.add(getter); |
| 1257 return null; | 1257 return null; |
| 1258 } | 1258 } |
| 1259 if (elementOrSelector is Selector | 1259 if (elementOrSelector is Selector |
| 1260 || elementOrSelector.isFunction() | 1260 || elementOrSelector.isFunction() |
| 1261 || elementOrSelector.isConstructor()) { | 1261 || elementOrSelector.isConstructor()) { |
| 1262 int requiredParameterCount; | 1262 int requiredParameterCount; |
| 1263 int optionalParameterCount; | 1263 int optionalParameterCount; |
| 1264 String namedArguments = ''; | 1264 String namedArguments = ''; |
| 1265 bool isConstructor; | 1265 bool isConstructor = false; |
| 1266 if (elementOrSelector is Selector) { | 1266 if (elementOrSelector is Selector) { |
| 1267 Selector selector = elementOrSelector; | 1267 Selector selector = elementOrSelector; |
| 1268 requiredParameterCount = selector.argumentCount; | 1268 requiredParameterCount = selector.argumentCount; |
| 1269 optionalParameterCount = 0; | 1269 optionalParameterCount = 0; |
| 1270 isConstructor = false; | |
| 1271 namedArguments = namedParametersAsReflectionNames(selector); | 1270 namedArguments = namedParametersAsReflectionNames(selector); |
| 1272 } else { | 1271 } else { |
| 1273 FunctionElement function = elementOrSelector; | 1272 FunctionElement function = elementOrSelector; |
| 1273 if (function.isConstructor()) { | |
| 1274 isConstructor = true; | |
| 1275 name = Elements.reconstructConstructorName(function); | |
|
ahe
2013/07/11 10:09:42
Add a TODO for me to get rid of this.
Johnni Winther
2013/07/11 13:09:19
Done.
| |
| 1276 } | |
| 1274 requiredParameterCount = function.requiredParameterCount(compiler); | 1277 requiredParameterCount = function.requiredParameterCount(compiler); |
| 1275 optionalParameterCount = function.optionalParameterCount(compiler); | 1278 optionalParameterCount = function.optionalParameterCount(compiler); |
| 1276 isConstructor = function.isConstructor(); | |
| 1277 FunctionSignature signature = function.computeSignature(compiler); | 1279 FunctionSignature signature = function.computeSignature(compiler); |
| 1278 if (signature.optionalParametersAreNamed) { | 1280 if (signature.optionalParametersAreNamed) { |
| 1279 var names = []; | 1281 var names = []; |
| 1280 for (Element e in signature.optionalParameters) { | 1282 for (Element e in signature.optionalParameters) { |
| 1281 names.add(e.name); | 1283 names.add(e.name); |
| 1282 } | 1284 } |
| 1283 Selector selector = new Selector.call( | 1285 Selector selector = new Selector.call( |
| 1284 function.name, | 1286 function.name, |
| 1285 function.getLibrary(), | 1287 function.getLibrary(), |
| 1286 requiredParameterCount, | 1288 requiredParameterCount, |
| (...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3700 | 3702 |
| 3701 const String HOOKS_API_USAGE = """ | 3703 const String HOOKS_API_USAGE = """ |
| 3702 // The code supports the following hooks: | 3704 // The code supports the following hooks: |
| 3703 // dartPrint(message) - if this function is defined it is called | 3705 // dartPrint(message) - if this function is defined it is called |
| 3704 // instead of the Dart [print] method. | 3706 // instead of the Dart [print] method. |
| 3705 // dartMainRunner(main) - if this function is defined, the Dart [main] | 3707 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 3706 // method will not be invoked directly. | 3708 // method will not be invoked directly. |
| 3707 // Instead, a closure that will invoke [main] is | 3709 // Instead, a closure that will invoke [main] is |
| 3708 // passed to [dartMainRunner]. | 3710 // passed to [dartMainRunner]. |
| 3709 """; | 3711 """; |
| OLD | NEW |