Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: lib/compiler/implementation/js_backend/emitter.dart

Issue 10911211: Runtime support for the new parameter specification. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,10 @@
assert(selector.namedArgumentCount == 0);
return;
}
+ if (parameters.optionalParametersAreNamed
kasperl 2012/09/12 11:34:48 Add a comment that explains what this does.
ngeoffray 2012/09/12 11:40:06 Done.
+ && selector.namedArgumentCount == parameters.optionalParameterCount) {
+ return;
+ }
ConstantHandler handler = compiler.constantHandler;
List<SourceString> names = selector.getOrderedNamedArguments();
@@ -363,6 +367,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.
// We fill the lists depending on the selector. For example,
// take method foo:
// foo(a, b, [c, d]);
@@ -810,10 +816,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 +881,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 +906,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 +1041,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).

Powered by Google App Engine
This is Rietveld 408576698