| 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 argumentsBuffer[0] = new js.VariableUse(receiverArgumentName); | 498 argumentsBuffer[0] = new js.VariableUse(receiverArgumentName); |
| 499 } | 499 } |
| 500 | 500 |
| 501 int indexOfLastOptionalArgumentInParameters = positionalArgumentCount - 1; | 501 int indexOfLastOptionalArgumentInParameters = positionalArgumentCount - 1; |
| 502 TreeElements elements = | 502 TreeElements elements = |
| 503 compiler.enqueuer.resolution.getCachedElements(member); | 503 compiler.enqueuer.resolution.getCachedElements(member); |
| 504 | 504 |
| 505 parameters.orderedForEachParameter((Element element) { | 505 parameters.orderedForEachParameter((Element element) { |
| 506 String jsName = JsNames.getValid(element.name.slowToString()); | 506 String jsName = JsNames.getValid(element.name.slowToString()); |
| 507 assert(jsName != receiverArgumentName); | 507 assert(jsName != receiverArgumentName); |
| 508 if (count < positionalArgumentCount + extraArgumentCount) { | 508 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; |
| 509 if (count < optionalParameterStart) { |
| 509 parametersBuffer[count] = new js.Parameter(jsName); | 510 parametersBuffer[count] = new js.Parameter(jsName); |
| 510 argumentsBuffer[count] = new js.VariableUse(jsName); | 511 argumentsBuffer[count] = new js.VariableUse(jsName); |
| 511 } else { | 512 } else { |
| 512 int index = names.indexOf(element.name); | 513 int index = names.indexOf(element.name); |
| 513 if (index != -1) { | 514 if (index != -1) { |
| 514 indexOfLastOptionalArgumentInParameters = count; | 515 indexOfLastOptionalArgumentInParameters = count; |
| 515 // The order of the named arguments is not the same as the | 516 // The order of the named arguments is not the same as the |
| 516 // one in the real method (which is in Dart source order). | 517 // one in the real method (which is in Dart source order). |
| 517 argumentsBuffer[count] = new js.VariableUse(jsName); | 518 argumentsBuffer[count] = new js.VariableUse(jsName); |
| 518 parametersBuffer[selector.positionalArgumentCount + index] = | 519 parametersBuffer[optionalParameterStart + index] = |
| 519 new js.Parameter(jsName); | 520 new js.Parameter(jsName); |
| 520 // Note that [elements] may be null for a synthesized [member]. | 521 // Note that [elements] may be null for a synthesized [member]. |
| 521 } else if (elements != null && elements.isParameterChecked(element)) { | 522 } else if (elements != null && elements.isParameterChecked(element)) { |
| 522 argumentsBuffer[count] = constantReference(SentinelConstant.SENTINEL); | 523 argumentsBuffer[count] = constantReference(SentinelConstant.SENTINEL); |
| 523 } else { | 524 } else { |
| 524 Constant value = handler.initialVariableValues[element]; | 525 Constant value = handler.initialVariableValues[element]; |
| 525 if (value == null) { | 526 if (value == null) { |
| 526 argumentsBuffer[count] = constantReference(new NullConstant()); | 527 argumentsBuffer[count] = constantReference(new NullConstant()); |
| 527 } else { | 528 } else { |
| 528 if (!value.isNull()) { | 529 if (!value.isNull()) { |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 """; | 2167 """; |
| 2167 const String HOOKS_API_USAGE = """ | 2168 const String HOOKS_API_USAGE = """ |
| 2168 // The code supports the following hooks: | 2169 // The code supports the following hooks: |
| 2169 // dartPrint(message) - if this function is defined it is called | 2170 // dartPrint(message) - if this function is defined it is called |
| 2170 // instead of the Dart [print] method. | 2171 // instead of the Dart [print] method. |
| 2171 // dartMainRunner(main) - if this function is defined, the Dart [main] | 2172 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 2172 // method will not be invoked directly. | 2173 // method will not be invoked directly. |
| 2173 // Instead, a closure that will invoke [main] is | 2174 // Instead, a closure that will invoke [main] is |
| 2174 // passed to [dartMainRunner]. | 2175 // passed to [dartMainRunner]. |
| 2175 """; | 2176 """; |
| OLD | NEW |