Index: lib/compiler/implementation/js_backend/emitter.dart |
=================================================================== |
--- lib/compiler/implementation/js_backend/emitter.dart (revision 12238) |
+++ lib/compiler/implementation/js_backend/emitter.dart (working copy) |
@@ -349,6 +349,13 @@ |
assert(selector.namedArgumentCount == 0); |
return; |
} |
+ if (parameters.optionalParametersAreNamed |
+ && selector.namedArgumentCount == parameters.optionalParameterCount) { |
+ // If the selector has the same number of named arguments than |
ahe
2012/09/13 14:29:10
than -> as
ngeoffray
2012/09/17 12:21:01
Done.
|
+ // the element, we don't need to add a stub. The call site will |
+ // hit the method directly. |
+ return; |
+ } |
ConstantHandler handler = compiler.constantHandler; |
List<SourceString> names = selector.getOrderedNamedArguments(); |
@@ -363,6 +370,8 @@ |
// The arguments that will be passed to the real method. |
List<String> argumentsBuffer = new List<String>(parameters.parameterCount); |
+ // TODO(5074): Update this comment once we remove support for |
+ // the deprecated parameter specification. |
ahe
2012/09/13 14:29:10
Actually, I think this comment should be moved to
ngeoffray
2012/09/17 12:21:01
Done.
|
// We fill the lists depending on the selector. For example, |
// take method foo: |
// foo(a, b, [c, d]); |
@@ -810,10 +819,7 @@ |
FunctionElement callElement = |
new ClosureInvocationElement(Namer.CLOSURE_INVOCATION_NAME, element); |
String staticName = namer.getName(element); |
- int parameterCount = element.parameterCount(compiler); |
- String invocationName = |
- namer.instanceMethodName(element.getLibrary(), callElement.name, |
- parameterCount); |
+ String invocationName = namer.instanceMethodName(callElement); |
String fieldAccess = '$isolateProperties.$staticName'; |
buffer.add("$fieldAccess.$invocationName = $fieldAccess;\n"); |
addParameterStubs(callElement, (String name, CodeBuffer value) { |
@@ -878,9 +884,7 @@ |
FunctionElement callElement = |
new ClosureInvocationElement(Namer.CLOSURE_INVOCATION_NAME, member); |
- String invocationName = |
- namer.instanceMethodName(member.getLibrary(), |
- callElement.name, parameterCount); |
+ String invocationName = namer.instanceMethodName(callElement); |
List<String> arguments = new List<String>(parameterCount); |
for (int i = 0; i < parameterCount; i++) { |
arguments[i] = "p$i"; |
@@ -905,8 +909,7 @@ |
// And finally the getter. |
String getterName = namer.getterName(member.getLibrary(), member.name); |
- String targetName = namer.instanceMethodName(member.getLibrary(), |
- member.name, parameterCount); |
+ String targetName = namer.instanceMethodName(member); |
CodeBuffer getterBuffer = new CodeBuffer(); |
getterBuffer.add( |
"function() { return new $closureClass(this, '$targetName'); }"); |
@@ -1041,7 +1044,7 @@ |
if (compiler.codegenWorld.instantiatedClasses.isEmpty()) return; |
String noSuchMethodName = |
- namer.instanceMethodName(null, Compiler.NO_SUCH_METHOD, 2); |
+ namer.instanceMethodNameByArity(Compiler.NO_SUCH_METHOD, 2); |
// Keep track of the JavaScript names we've already added so we |
// do not introduce duplicates (bad for code size). |