| 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class ParameterStubGenerator { | 7 class ParameterStubGenerator { |
| 8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); | 8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); |
| 9 | 9 |
| 10 final Namer namer; | 10 final Namer namer; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (isInterceptedMethod) { | 76 if (isInterceptedMethod) { |
| 77 count++; | 77 count++; |
| 78 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); | 78 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); |
| 79 argumentsBuffer[0] = js('#', receiverArgumentName); | 79 argumentsBuffer[0] = js('#', receiverArgumentName); |
| 80 } | 80 } |
| 81 | 81 |
| 82 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; | 82 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; |
| 83 // Includes extra receiver argument when using interceptor convention | 83 // Includes extra receiver argument when using interceptor convention |
| 84 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1; | 84 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1; |
| 85 | 85 |
| 86 int parameterIndex = 0; | |
| 87 parameters.orderedForEachParameter((ParameterElement element) { | 86 parameters.orderedForEachParameter((ParameterElement element) { |
| 88 String jsName = backend.namer.safeVariableName(element.name); | 87 String jsName = backend.namer.safeVariableName(element.name); |
| 89 assert(jsName != receiverArgumentName); | 88 assert(jsName != receiverArgumentName); |
| 90 if (count < optionalParameterStart) { | 89 if (count < optionalParameterStart) { |
| 91 parametersBuffer[count] = new jsAst.Parameter(jsName); | 90 parametersBuffer[count] = new jsAst.Parameter(jsName); |
| 92 argumentsBuffer[count] = js('#', jsName); | 91 argumentsBuffer[count] = js('#', jsName); |
| 93 } else { | 92 } else { |
| 94 int index = names.indexOf(element.name); | 93 int index = names.indexOf(element.name); |
| 95 if (index != -1) { | 94 if (index != -1) { |
| 96 indexOfLastOptionalArgumentInParameters = count; | 95 indexOfLastOptionalArgumentInParameters = count; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 generateParameterStub(member, selector, null); | 271 generateParameterStub(member, selector, null); |
| 273 if (stub != null) { | 272 if (stub != null) { |
| 274 stubs.add(stub); | 273 stubs.add(stub); |
| 275 } | 274 } |
| 276 } | 275 } |
| 277 } | 276 } |
| 278 | 277 |
| 279 return stubs; | 278 return stubs; |
| 280 } | 279 } |
| 281 } | 280 } |
| OLD | NEW |