| 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 /** | 5 /** |
| 6 * A function element that represents a closure call. The signature is copied | 6 * A function element that represents a closure call. The signature is copied |
| 7 * from the given element. | 7 * from the given element. |
| 8 */ | 8 */ |
| 9 class ClosureInvocationElement extends FunctionElement { | 9 class ClosureInvocationElement extends FunctionElement { |
| 10 ClosureInvocationElement(SourceString name, | 10 ClosureInvocationElement(SourceString name, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } else { | 140 } else { |
| 141 Constant value = handler.initialVariableValues[element]; | 141 Constant value = handler.initialVariableValues[element]; |
| 142 if (value == null) { | 142 if (value == null) { |
| 143 argumentsBuffer[count] = '(void 0)'; | 143 argumentsBuffer[count] = '(void 0)'; |
| 144 } else { | 144 } else { |
| 145 if (!value.isNull()) { | 145 if (!value.isNull()) { |
| 146 // If the value is the null constant, we should not pass it | 146 // If the value is the null constant, we should not pass it |
| 147 // down to the native method. | 147 // down to the native method. |
| 148 indexOfLastOptionalArgumentInParameters = count; | 148 indexOfLastOptionalArgumentInParameters = count; |
| 149 } | 149 } |
| 150 argumentsBuffer[count] = | 150 StringBuffer argumentBuffer = new StringBuffer(); |
| 151 handler.writeJsCode(new StringBuffer(), value).toString(); | 151 handler.writeConstant(argumentBuffer, value); |
| 152 argumentsBuffer[count] = argumentBuffer.toString(); |
| 152 } | 153 } |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 count++; | 156 count++; |
| 156 }); | 157 }); |
| 157 String parametersString = Strings.join(parametersBuffer, ","); | 158 String parametersString = Strings.join(parametersBuffer, ","); |
| 158 buffer.add('$parametersString) {\n'); | 159 buffer.add('$parametersString) {\n'); |
| 159 | 160 |
| 160 if (isNative) { | 161 if (isNative) { |
| 161 nativeEmitter.emitParameterStub( | 162 nativeEmitter.emitParameterStub( |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 nativeEmitter.emitDynamicDispatchMetadata(); | 722 nativeEmitter.emitDynamicDispatchMetadata(); |
| 722 mainBuffer.add( | 723 mainBuffer.add( |
| 723 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); | 724 'var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); |
| 724 nativeEmitter.assembleCode(mainBuffer); | 725 nativeEmitter.assembleCode(mainBuffer); |
| 725 emitMain(mainBuffer); | 726 emitMain(mainBuffer); |
| 726 compiler.assembledCode = mainBuffer.toString(); | 727 compiler.assembledCode = mainBuffer.toString(); |
| 727 }); | 728 }); |
| 728 return compiler.assembledCode; | 729 return compiler.assembledCode; |
| 729 } | 730 } |
| 730 } | 731 } |
| OLD | NEW |