| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// This class should morph into something that makes it easy to build | 7 /// This class should morph into something that makes it easy to build |
| 8 /// JavaScript representations of libraries, class-sides, and instance-sides. | 8 /// JavaScript representations of libraries, class-sides, and instance-sides. |
| 9 /// Initially, it is just a placeholder for code that is moved from | 9 /// Initially, it is just a placeholder for code that is moved from |
| 10 /// [CodeEmitterTask]. | 10 /// [CodeEmitterTask]. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); | 73 parametersBuffer[0] = new jsAst.Parameter(receiverArgumentName); |
| 74 argumentsBuffer[0] = js('#', receiverArgumentName); | 74 argumentsBuffer[0] = js('#', receiverArgumentName); |
| 75 task.interceptorEmitter.interceptorInvocationNames.add(invocationName); | 75 task.interceptorEmitter.interceptorInvocationNames.add(invocationName); |
| 76 } | 76 } |
| 77 | 77 |
| 78 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; | 78 int optionalParameterStart = positionalArgumentCount + extraArgumentCount; |
| 79 // Includes extra receiver argument when using interceptor convention | 79 // Includes extra receiver argument when using interceptor convention |
| 80 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1; | 80 int indexOfLastOptionalArgumentInParameters = optionalParameterStart - 1; |
| 81 | 81 |
| 82 int parameterIndex = 0; | 82 int parameterIndex = 0; |
| 83 parameters.orderedForEachParameter((Element element) { | 83 parameters.orderedForEachParameter((ParameterElement element) { |
| 84 String jsName = backend.namer.safeName(element.name); | 84 String jsName = backend.namer.safeName(element.name); |
| 85 assert(jsName != receiverArgumentName); | 85 assert(jsName != receiverArgumentName); |
| 86 if (count < optionalParameterStart) { | 86 if (count < optionalParameterStart) { |
| 87 parametersBuffer[count] = new jsAst.Parameter(jsName); | 87 parametersBuffer[count] = new jsAst.Parameter(jsName); |
| 88 argumentsBuffer[count] = js('#', jsName); | 88 argumentsBuffer[count] = js('#', jsName); |
| 89 } else { | 89 } else { |
| 90 int index = names.indexOf(element.name); | 90 int index = names.indexOf(element.name); |
| 91 if (index != -1) { | 91 if (index != -1) { |
| 92 indexOfLastOptionalArgumentInParameters = count; | 92 indexOfLastOptionalArgumentInParameters = count; |
| 93 // The order of the named arguments is not the same as the | 93 // The order of the named arguments is not the same as the |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } else if (isClosure && canBeApplied) { | 539 } else if (isClosure && canBeApplied) { |
| 540 expressions.add(js.string(member.name)); | 540 expressions.add(js.string(member.name)); |
| 541 } | 541 } |
| 542 builder.addProperty(name, new jsAst.ArrayInitializer.from(expressions)); | 542 builder.addProperty(name, new jsAst.ArrayInitializer.from(expressions)); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void addMemberField(VariableElement member, ClassBuilder builder) { | 545 void addMemberField(VariableElement member, ClassBuilder builder) { |
| 546 // For now, do nothing. | 546 // For now, do nothing. |
| 547 } | 547 } |
| 548 } | 548 } |
| OLD | NEW |