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

Unified Diff: runtime/vm/resolver.cc

Issue 10695137: Provide better error message when passing wrong number of arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/resolver.cc
===================================================================
--- runtime/vm/resolver.cc (revision 9601)
+++ runtime/vm/resolver.cc (working copy)
@@ -62,14 +62,21 @@
}
if (function.IsNull() ||
!function.AreValidArgumentCounts(num_arguments,
- num_named_arguments)) {
+ num_named_arguments,
+ NULL)) {
// Return a null function to signal to the upper levels to dispatch to
// "noSuchMethod" function.
if (FLAG_trace_resolving) {
+ String& error_message = String::Handle(String::New("function not found"));
+ if (!function.IsNull()) {
+ // Obtain more detailed error message.
+ function.AreValidArgumentCounts(num_arguments,
+ num_named_arguments,
+ &error_message);
+ }
OS::Print("ResolveDynamic error '%s': %s.\n",
function_name.ToCString(),
- function.IsNull() ?
- "function not found" : "argument count mismatch");
+ error_message.ToCString());
}
return Function::null();
}
@@ -90,10 +97,16 @@
const Object& object = Object::Handle(library.LookupObject(function_name));
if (!object.IsNull() && object.IsFunction()) {
function ^= object.raw();
- if (!function.AreValidArguments(num_arguments, argument_names)) {
+ if (!function.AreValidArguments(num_arguments, argument_names, NULL)) {
if (FLAG_trace_resolving) {
+ String& error_message = String::Handle();
+ // Obtain more detailed error message.
+ function.AreValidArguments(num_arguments,
+ argument_names,
+ &error_message);
OS::Print("ResolveStatic error '%s': %s.\n",
- function_name.ToCString(), "arguments mismatch");
+ function_name.ToCString(),
+ error_message.ToCString());
}
function = Function::null();
}
@@ -156,14 +169,20 @@
const Function& function = Function::Handle(
ResolveStaticByName(cls, function_name, resolve_type));
if (function.IsNull() ||
- !function.AreValidArguments(num_arguments, argument_names)) {
+ !function.AreValidArguments(num_arguments, argument_names, NULL)) {
// Return a null function to signal to the upper levels to throw a
// resolution error or maybe throw the error right here.
if (FLAG_trace_resolving) {
+ String& error_message = String::Handle(String::New("function not found"));
+ if (!function.IsNull()) {
+ // Obtain more detailed error message.
+ function.AreValidArguments(num_arguments,
+ argument_names,
+ &error_message);
+ }
OS::Print("ResolveStatic error '%s': %s.\n",
function_name.ToCString(),
- function.IsNull() ?
- "function not found" : "arguments mismatch");
+ error_message.ToCString());
}
return Function::null();
}
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698