| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.js_emitter.parameter_stub_generator; | 5 library dart2js.js_emitter.parameter_stub_generator; |
| 6 | 6 |
| 7 import '../closure.dart' show ClosureClassElement; | 7 import '../closure.dart' show ClosureClassElement; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common_elements.dart'; | 9 import '../common_elements.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (isInterceptedMethod) { | 114 if (isInterceptedMethod) { |
| 115 count++; | 115 count++; |
| 116 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); | 116 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); |
| 117 argumentsBuffer[0] = js('#', receiverArgumentName); | 117 argumentsBuffer[0] = js('#', receiverArgumentName); |
| 118 } | 118 } |
| 119 | 119 |
| 120 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; | 120 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; |
| 121 // Includes extra receiver argument when using interceptor convention | 121 // Includes extra receiver argument when using interceptor convention |
| 122 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1; | 122 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1; |
| 123 | 123 |
| 124 parameters.orderedForEachParameter((ParameterElement element) { | 124 parameters.orderedForEachParameter((_element) { |
| 125 ParameterElement element = _element; |
| 125 String jsName = _namer.safeVariableName(element.name); | 126 String jsName = _namer.safeVariableName(element.name); |
| 126 assert(jsName != receiverArgumentName); | 127 assert(jsName != receiverArgumentName); |
| 127 if (count < optionalParameterStart) { | 128 if (count < optionalParameterStart) { |
| 128 parametersBuffer[count] = new jsAst.Parameter(jsName); | 129 parametersBuffer[count] = new jsAst.Parameter(jsName); |
| 129 argumentsBuffer[count] = js('#', jsName); | 130 argumentsBuffer[count] = js('#', jsName); |
| 130 } else { | 131 } else { |
| 131 int index = names.indexOf(element.name); | 132 int index = names.indexOf(element.name); |
| 132 if (index != -1) { | 133 if (index != -1) { |
| 133 indexOfLastOptionalArgumentInParameters = count; | 134 indexOfLastOptionalArgumentInParameters = count; |
| 134 // The order of the named arguments is not the same as the | 135 // The order of the named arguments is not the same as the |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 generateParameterStub(member, selector, null); | 317 generateParameterStub(member, selector, null); |
| 317 if (stub != null) { | 318 if (stub != null) { |
| 318 stubs.add(stub); | 319 stubs.add(stub); |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 } | 322 } |
| 322 | 323 |
| 323 return stubs; | 324 return stubs; |
| 324 } | 325 } |
| 325 } | 326 } |
| OLD | NEW |