| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 int index = names.indexOf(element.name); | 317 int index = names.indexOf(element.name); |
| 318 if (index != -1) { | 318 if (index != -1) { |
| 319 indexOfLastOptionalArgumentInParameters = count; | 319 indexOfLastOptionalArgumentInParameters = count; |
| 320 // The order of the named arguments is not the same as the | 320 // The order of the named arguments is not the same as the |
| 321 // one in the real method (which is in Dart source order). | 321 // one in the real method (which is in Dart source order). |
| 322 argumentsBuffer[count] = jsName; | 322 argumentsBuffer[count] = jsName; |
| 323 parametersBuffer[selector.positionalArgumentCount + index] = jsName; | 323 parametersBuffer[selector.positionalArgumentCount + index] = jsName; |
| 324 } else { | 324 } else { |
| 325 Constant value = handler.initialVariableValues[element]; | 325 Constant value = handler.initialVariableValues[element]; |
| 326 if (value == null) { | 326 if (value == null) { |
| 327 argumentsBuffer[count] = '(void 0)'; | 327 argumentsBuffer[count] = NullConstant.JsNull; |
| 328 } else { | 328 } else { |
| 329 if (!value.isNull()) { | 329 if (!value.isNull()) { |
| 330 // If the value is the null constant, we should not pass it | 330 // If the value is the null constant, we should not pass it |
| 331 // down to the native method. | 331 // down to the native method. |
| 332 indexOfLastOptionalArgumentInParameters = count; | 332 indexOfLastOptionalArgumentInParameters = count; |
| 333 } | 333 } |
| 334 StringBuffer argumentBuffer = new StringBuffer(); | 334 StringBuffer argumentBuffer = new StringBuffer(); |
| 335 handler.writeConstant(argumentBuffer, value); | 335 handler.writeConstant(argumentBuffer, value); |
| 336 argumentsBuffer[count] = argumentBuffer.toString(); | 336 argumentsBuffer[count] = argumentBuffer.toString(); |
| 337 } | 337 } |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 mainBuffer.add('function init() {\n'); | 1029 mainBuffer.add('function init() {\n'); |
| 1030 mainBuffer.add(' $isolateProperties = {};\n'); | 1030 mainBuffer.add(' $isolateProperties = {};\n'); |
| 1031 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); | 1031 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); |
| 1032 emitFinishIsolateConstructor(mainBuffer); | 1032 emitFinishIsolateConstructor(mainBuffer); |
| 1033 mainBuffer.add('}\n'); | 1033 mainBuffer.add('}\n'); |
| 1034 compiler.assembledCode = mainBuffer.toString(); | 1034 compiler.assembledCode = mainBuffer.toString(); |
| 1035 }); | 1035 }); |
| 1036 return compiler.assembledCode; | 1036 return compiler.assembledCode; |
| 1037 } | 1037 } |
| 1038 } | 1038 } |
| OLD | NEW |