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

Side by Side Diff: lib/compiler/implementation/js_backend/emitter.dart

Issue 10991034: Order the parameters of a function at the definition site. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // The parameters that this stub takes. 381 // The parameters that this stub takes.
382 List<String> parametersBuffer = new List<String>(selector.argumentCount); 382 List<String> parametersBuffer = new List<String>(selector.argumentCount);
383 // The arguments that will be passed to the real method. 383 // The arguments that will be passed to the real method.
384 List<String> argumentsBuffer = new List<String>(parameters.parameterCount); 384 List<String> argumentsBuffer = new List<String>(parameters.parameterCount);
385 385
386 int count = 0; 386 int count = 0;
387 int indexOfLastOptionalArgumentInParameters = positionalArgumentCount - 1; 387 int indexOfLastOptionalArgumentInParameters = positionalArgumentCount - 1;
388 TreeElements elements = 388 TreeElements elements =
389 compiler.enqueuer.resolution.getCachedElements(member); 389 compiler.enqueuer.resolution.getCachedElements(member);
390 390
391 parameters.forEachParameter((Element element) { 391 parameters.orderedForEachParameter((Element element) {
392 String jsName = JsNames.getValid(element.name.slowToString()); 392 String jsName = JsNames.getValid(element.name.slowToString());
393 if (count < positionalArgumentCount) { 393 if (count < positionalArgumentCount) {
394 parametersBuffer[count] = jsName; 394 parametersBuffer[count] = jsName;
395 argumentsBuffer[count] = jsName; 395 argumentsBuffer[count] = jsName;
396 } else { 396 } else {
397 int index = names.indexOf(element.name); 397 int index = names.indexOf(element.name);
398 if (index != -1) { 398 if (index != -1) {
399 indexOfLastOptionalArgumentInParameters = count; 399 indexOfLastOptionalArgumentInParameters = count;
400 // The order of the named arguments is not the same as the 400 // The order of the named arguments is not the same as the
401 // one in the real method (which is in Dart source order). 401 // one in the real method (which is in Dart source order).
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 const String HOOKS_API_USAGE = """ 1434 const String HOOKS_API_USAGE = """
1435 // Generated by dart2js, the Dart to JavaScript compiler. 1435 // Generated by dart2js, the Dart to JavaScript compiler.
1436 // The code supports the following hooks: 1436 // The code supports the following hooks:
1437 // dartPrint(message) - if this function is defined it is called 1437 // dartPrint(message) - if this function is defined it is called
1438 // instead of the Dart [print] method. 1438 // instead of the Dart [print] method.
1439 // dartMainRunner(main) - if this function is defined, the Dart [main] 1439 // dartMainRunner(main) - if this function is defined, the Dart [main]
1440 // method will not be invoked directly. 1440 // method will not be invoked directly.
1441 // Instead, a closure that will invoke [main] is 1441 // Instead, a closure that will invoke [main] is
1442 // passed to [dartMainRunner]. 1442 // passed to [dartMainRunner].
1443 """; 1443 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698