Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 26748) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -7206,13 +7206,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* actuals, |
|
regis
2013/08/28 21:10:54
function_arguments
zra
2013/08/28 22:47:00
Done.
|
| InvocationMirror::Call im_call, |
| InvocationMirror::Type im_type) { |
| ArgumentListNode* arguments = new ArgumentListNode(call_pos); |
| @@ -7236,15 +7233,24 @@ |
| 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 (actuals == NULL) { |
| + arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle())); |
| + } else { |
| + ArrayNode* array = new ArrayNode( |
| + call_pos, Type::ZoneHandle(Type::ArrayType()), actuals->nodes()); |
| + arguments->Add(array); |
| + } |
| // List argumentNames. |
| - arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle())); |
| + if (actuals == NULL) { |
| + arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle())); |
| + } else { |
| + arguments->Add(new LiteralNode(call_pos, actuals->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(); |
| @@ -7748,7 +7754,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 +7843,7 @@ |
| return ThrowNoSuchMethodError(ident_pos, |
| cls, |
| func_name, |
| + arguments, |
| InvocationMirror::kStatic, |
| InvocationMirror::kMethod); |
| } else if (cls.IsTopLevel() && |
| @@ -9759,6 +9766,7 @@ |
| return ThrowNoSuchMethodError(call_pos, |
| type_class, |
| external_constructor_name, |
| + arguments, |
| InvocationMirror::kConstructor, |
| InvocationMirror::kMethod); |
| } else if (constructor.IsRedirectingFactory()) { |
| @@ -9826,6 +9834,7 @@ |
| return ThrowNoSuchMethodError(call_pos, |
| type_class, |
| external_constructor_name, |
| + arguments, |
| InvocationMirror::kConstructor, |
| InvocationMirror::kMethod); |
| } |