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

Unified Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 742023002: Handle named and optional arguments in cps-ir. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/compile_time_constants.dart
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index 7b0494365797ef2bd23e32e0e1b8c4fad197657e..c6ee4a172bed317e725b1c1e6ae03f49de21ba1e 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -643,20 +643,14 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
FunctionElement target,
{AstConstant compileArgument(Node node)}) {
assert(invariant(node, target.isImplementation));
- List<AstConstant> compiledArguments = <AstConstant>[];
AstConstant compileDefaultValue(VariableElement element) {
ConstantExpression constant = handler.compileConstant(element);
return new AstConstant.fromDefaultValue(element, constant);
}
target.computeSignature(compiler);
- bool succeeded = selector.addArgumentsToList(arguments,
- compiledArguments,
- target,
- compileArgument,
- compileDefaultValue,
- compiler.world);
- if (!succeeded) {
+
+ if (!selector.applies(target, compiler.world)) {
String name = Elements.constructorNameForDiagnostics(
target.enclosingClass.name, target.name);
compiler.reportFatalError(
@@ -664,7 +658,10 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
MessageKind.INVALID_CONSTRUCTOR_ARGUMENTS,
{'constructorName': name});
}
- return compiledArguments;
+ return selector.makeArgumentsList(arguments,
+ target,
+ compileArgument,
+ compileDefaultValue);
}
AstConstant visitNewExpression(NewExpression node) {

Powered by Google App Engine
This is Rietveld 408576698