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

Side by Side Diff: pkg/compiler/lib/src/universe/universe.dart

Issue 908863003: dart2js cps: Handle optional parameters in builder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed obsolete TODO Created 5 years, 10 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 library universe; 5 library universe;
6 6
7 import '../elements/elements.dart'; 7 import '../elements/elements.dart';
8 import '../dart2jslib.dart'; 8 import '../dart2jslib.dart';
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../types/types.dart'; 10 import '../types/types.dart';
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if (foundIndex != -1) { 586 if (foundIndex != -1) {
587 result.add(compiledNamedArguments[foundIndex]); 587 result.add(compiledNamedArguments[foundIndex]);
588 } else { 588 } else {
589 result.add(compileDefaultValue(element)); 589 result.add(compileDefaultValue(element));
590 } 590 }
591 }); 591 });
592 } 592 }
593 return result; 593 return result;
594 } 594 }
595 595
596 /// Returns a copy of [compiledArguments] where named arguments occur in
597 /// normalized order.
598 List makeDynamicArgumentsList(List compiledArguments) {
karlklose 2015/02/10 09:07:45 I am not happy with having this helper here. Could
asgerf 2015/02/10 09:37:18 I agree. I put it here because makeArgumentsList
599 assert(compiledArguments.length == argumentCount);
600 List result = [];
601 for (int i=0; i<positionalArgumentCount; i++) {
karlklose 2015/02/10 09:07:45 Space around binary operators.
asgerf 2015/02/10 09:37:18 Done.
602 result.add(compiledArguments[i]);
603 }
604 for (String argName in getOrderedNamedArguments()) {
605 int nameIndex = namedArguments.indexOf(argName);
606 int translatedIndex = positionalArgumentCount + nameIndex;
607 result.add(compiledArguments[translatedIndex]);
608 }
609 return result;
610 }
596 611
597 /** 612 /**
598 * Fills [list] with the arguments in the order expected by 613 * Fills [list] with the arguments in the order expected by
599 * [callee], and where [caller] is a synthesized element 614 * [callee], and where [caller] is a synthesized element
600 * 615 *
601 * [compileArgument] is a function that returns a compiled version 616 * [compileArgument] is a function that returns a compiled version
602 * of a parameter of [callee]. 617 * of a parameter of [callee].
603 * 618 *
604 * [compileConstant] is a function that returns a compiled constant 619 * [compileConstant] is a function that returns a compiled constant
605 * of an optional argument that is not in the parameters of [callee]. 620 * of an optional argument that is not in the parameters of [callee].
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 857
843 Selector extendIfReachesAll(Compiler compiler) { 858 Selector extendIfReachesAll(Compiler compiler) {
844 bool canReachAll = compiler.enabledInvokeOn 859 bool canReachAll = compiler.enabledInvokeOn
845 && mask.needsNoSuchMethodHandling(this, compiler.world); 860 && mask.needsNoSuchMethodHandling(this, compiler.world);
846 return canReachAll 861 return canReachAll
847 ? new TypedSelector( 862 ? new TypedSelector(
848 compiler.typesTask.dynamicType, this, compiler.world) 863 compiler.typesTask.dynamicType, this, compiler.world)
849 : this; 864 : this;
850 } 865 }
851 } 866 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698