Index: lib/compiler/implementation/compile_time_constants.dart |
=================================================================== |
--- lib/compiler/implementation/compile_time_constants.dart (revision 12420) |
+++ lib/compiler/implementation/compile_time_constants.dart (working copy) |
@@ -530,7 +530,8 @@ |
} |
/** Returns the list of constants that are passed to the static function. */ |
- List<Constant> evaluateArgumentsToConstructor(Selector selector, |
+ List<Constant> evaluateArgumentsToConstructor(Node node, |
+ Selector selector, |
Link<Node> arguments, |
FunctionElement target) { |
List<Constant> compiledArguments = <Constant>[]; |
@@ -543,7 +544,11 @@ |
compileArgument, |
compileConstant, |
compiler); |
- assert(succeeded); |
+ if (!succeeded) { |
+ MessageKind kind = MessageKind.INVALID_ARGUMENTS; |
+ compiler.reportError(node, |
+ new CompileTimeConstantError(kind, [target.name.slowToString()])); |
+ } |
return compiledArguments; |
} |
@@ -562,8 +567,8 @@ |
} |
Selector selector = elements.getSelector(send); |
- List<Constant> arguments = |
- evaluateArgumentsToConstructor(selector, send.arguments, constructor); |
+ List<Constant> arguments = evaluateArgumentsToConstructor( |
+ node, selector, send.arguments, constructor); |
ConstructorEvaluator evaluator = |
new ConstructorEvaluator(constructor, constantSystem, compiler); |
evaluator.evaluateConstructorFieldValues(arguments); |
@@ -682,11 +687,12 @@ |
}); |
} |
- void evaluateSuperOrRedirectSend(Selector selector, |
+ void evaluateSuperOrRedirectSend(Node currentNode, |
+ Selector selector, |
Link<Node> arguments, |
FunctionElement targetConstructor) { |
- List<Constant> compiledArguments = |
- evaluateArgumentsToConstructor(selector, arguments, targetConstructor); |
+ List<Constant> compiledArguments = evaluateArgumentsToConstructor( |
+ currentNode, selector, arguments, targetConstructor); |
ConstructorEvaluator evaluator = new ConstructorEvaluator( |
targetConstructor, constantSystem, compiler); |
@@ -718,7 +724,8 @@ |
FunctionElement targetConstructor = elements[call]; |
Selector selector = elements.getSelector(call); |
Link<Node> arguments = call.arguments; |
- evaluateSuperOrRedirectSend(selector, arguments, targetConstructor); |
+ evaluateSuperOrRedirectSend( |
+ call, selector, arguments, targetConstructor); |
foundSuperOrRedirect = true; |
} else { |
// A field initializer. |
@@ -749,7 +756,8 @@ |
Selector selector = new Selector.call(superClass.name, |
enclosingClass.getLibrary(), |
0); |
- evaluateSuperOrRedirectSend(selector, |
+ evaluateSuperOrRedirectSend(functionNode, |
+ selector, |
const EmptyLink<Node>(), |
targetConstructor); |
} |