| Index: runtime/vm/parser.cc
|
| ===================================================================
|
| --- runtime/vm/parser.cc (revision 26748)
|
| +++ runtime/vm/parser.cc (working copy)
|
| @@ -2818,6 +2818,7 @@
|
| ThrowNoSuchMethodError(TokenPos(),
|
| current_class(),
|
| function_name,
|
| + NULL, // No arguments.
|
| func.is_static() ?
|
| InvocationMirror::kStatic :
|
| InvocationMirror::kDynamic,
|
| @@ -7206,13 +7207,10 @@
|
| }
|
|
|
|
|
| -// TODO(regis): Providing the argument values is not always feasible, since
|
| -// evaluating them could throw an error.
|
| -// Should NoSuchMethodError reflect the argument count and names instead of
|
| -// argument values? Or should the spec specify a different evaluation order?
|
| AstNode* Parser::ThrowNoSuchMethodError(intptr_t call_pos,
|
| const Class& cls,
|
| const String& function_name,
|
| + ArgumentListNode* function_arguments,
|
| InvocationMirror::Call im_call,
|
| InvocationMirror::Type im_type) {
|
| ArgumentListNode* arguments = new ArgumentListNode(call_pos);
|
| @@ -7236,15 +7234,25 @@
|
| arguments->Add(new LiteralNode(call_pos, Smi::ZoneHandle(
|
| Smi::New(InvocationMirror::EncodeType(im_call, im_type)))));
|
| // List arguments.
|
| - arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
|
| + if (function_arguments == NULL) {
|
| + arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
|
| + } else {
|
| + ArrayNode* array = new ArrayNode(call_pos,
|
| + Type::ZoneHandle(Type::ArrayType()),
|
| + function_arguments->nodes());
|
| + arguments->Add(array);
|
| + }
|
| // List argumentNames.
|
| - arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
|
| + if (function_arguments == NULL) {
|
| + arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
|
| + } else {
|
| + arguments->Add(new LiteralNode(call_pos, function_arguments->names()));
|
| + }
|
| // List existingArgumentNames.
|
| // Check if there exists a function with the same name.
|
| Function& function =
|
| Function::Handle(cls.LookupStaticFunction(function_name));
|
| if (function.IsNull()) {
|
| - // TODO(srdjan): Store argument values into the argument list.
|
| arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
|
| } else {
|
| const int total_num_parameters = function.NumParameters();
|
| @@ -7544,6 +7552,7 @@
|
| result = ThrowNoSuchMethodError(original->token_pos(),
|
| current_class(),
|
| name,
|
| + NULL, // No arguments.
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kSetter);
|
| } else if (result->IsStoreIndexedNode() ||
|
| @@ -7748,7 +7757,7 @@
|
| arguments = implicit_arguments;
|
| }
|
| const GrowableObjectArray& names =
|
| - GrowableObjectArray::Handle(GrowableObjectArray::New());
|
| + GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld));
|
| bool named_argument_seen = false;
|
| if (LookaheadToken(1) != Token::kRPAREN) {
|
| String& arg_name = String::Handle();
|
| @@ -7837,6 +7846,7 @@
|
| return ThrowNoSuchMethodError(ident_pos,
|
| cls,
|
| func_name,
|
| + arguments,
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kMethod);
|
| } else if (cls.IsTopLevel() &&
|
| @@ -7937,6 +7947,7 @@
|
| return ThrowNoSuchMethodError(ident_pos,
|
| cls,
|
| field_name,
|
| + NULL, // No arguments.
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kField);
|
| }
|
| @@ -7981,6 +7992,7 @@
|
| return ThrowNoSuchMethodError(ident_pos,
|
| cls,
|
| field_name,
|
| + NULL, // No arguments.
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kGetter);
|
| }
|
| @@ -8020,6 +8032,7 @@
|
| return ThrowNoSuchMethodError(primary->token_pos(),
|
| current_class(),
|
| name,
|
| + NULL, // No arguments.
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kField);
|
| } else {
|
| @@ -8191,6 +8204,7 @@
|
| selector = ThrowNoSuchMethodError(primary->token_pos(),
|
| current_class(),
|
| name,
|
| + NULL, // No arguments.
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kMethod);
|
| } else {
|
| @@ -8204,6 +8218,7 @@
|
| selector = ThrowNoSuchMethodError(primary->token_pos(),
|
| current_class(),
|
| name,
|
| + NULL, // No arguments.
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kMethod);
|
| } else if (primary->primary().IsClass()) {
|
| @@ -9102,6 +9117,7 @@
|
| resolved = ThrowNoSuchMethodError(ident_pos,
|
| current_class(),
|
| ident,
|
| + NULL, // No arguments.
|
| InvocationMirror::kStatic,
|
| InvocationMirror::kField);
|
| } else {
|
| @@ -9759,6 +9775,7 @@
|
| return ThrowNoSuchMethodError(call_pos,
|
| type_class,
|
| external_constructor_name,
|
| + arguments,
|
| InvocationMirror::kConstructor,
|
| InvocationMirror::kMethod);
|
| } else if (constructor.IsRedirectingFactory()) {
|
| @@ -9826,6 +9843,7 @@
|
| return ThrowNoSuchMethodError(call_pos,
|
| type_class,
|
| external_constructor_name,
|
| + arguments,
|
| InvocationMirror::kConstructor,
|
| InvocationMirror::kMethod);
|
| }
|
|
|