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

Unified 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: Fix static invoke 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/universe/universe.dart
diff --git a/pkg/compiler/lib/src/universe/universe.dart b/pkg/compiler/lib/src/universe/universe.dart
index a7ddbb03bd91dbda5eafd2af2d45e2c0c780f12d..3deffcba75cd27966bafcbcc8b0126afc809a713 100644
--- a/pkg/compiler/lib/src/universe/universe.dart
+++ b/pkg/compiler/lib/src/universe/universe.dart
@@ -506,49 +506,7 @@ class Selector {
*
* Invariant: [element] must be the implementation element.
*/
- /*<S, T>*/ List/*<T>*/ makeArgumentsList(
- FunctionElement element,
- List/*<T>*/ compiledArguments,
- /*T*/ compileDefaultValue(ParameterElement element)) {
- assert(invariant(element, element.isImplementation));
- List/*<T>*/ result = new List();
- FunctionSignature parameters = element.functionSignature;
- int i = 0;
- parameters.forEachRequiredParameter((ParameterElement element) {
- result.add(compiledArguments[i]);
- ++i;
- });
-
- if (!parameters.optionalParametersAreNamed) {
- parameters.forEachOptionalParameter((ParameterElement element) {
- if (i < compiledArguments.length) {
- result.add(compiledArguments[i]);
- ++i;
- } else {
- result.add(compileDefaultValue(element));
- }
- });
- } else {
- int offset = i;
- // Iterate over the optional parameters of the signature, and try to
- // find them in [compiledNamedArguments]. If found, we use the
- // value in the temporary list, otherwise the default value.
- parameters.orderedOptionalParameters
- .forEach((ParameterElement element) {
- int foundIndex = namedArguments.indexOf(element.name);
- if (foundIndex != -1) {
- result.add(compiledArguments[offset + foundIndex]);
- } else {
- result.add(compileDefaultValue(element));
- }
- });
- }
- return result;
- }
-
- /// This is a version of [makeArgumentsList] that works for a `Link`
- /// representation of arguments.
- /*<T>*/ List/*<T>*/ makeArgumentsList2(
+ /*<T>*/ List/*<T>*/ makeArgumentsList(
Link<Node> arguments,
FunctionElement element,
/*T*/ compileArgument(Node argument),
@@ -593,7 +551,6 @@ class Selector {
return result;
}
-
/**
* Fills [list] with the arguments in the order expected by
* [callee], and where [caller] is a synthesized element
@@ -661,10 +618,10 @@ class Selector {
namedParameters);
if (!selector.applies(callee, world)) return false;
- list.addAll(selector.makeArgumentsList2(nodes,
- callee,
- internalCompileArgument,
- compileConstant));
+ list.addAll(selector.makeArgumentsList(nodes,
+ callee,
+ internalCompileArgument,
+ compileConstant));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698