| Index: runtime/lib/object.cc
|
| ===================================================================
|
| --- runtime/lib/object.cc (revision 3908)
|
| +++ runtime/lib/object.cc (working copy)
|
| @@ -29,6 +29,38 @@
|
| dart_arguments.Add(&instance);
|
| dart_arguments.Add(&function_name);
|
| dart_arguments.Add(&func_args);
|
| + // Report if a function with same name (but different arguments) has been
|
| + // found.
|
| + Class& instance_class = Class::Handle(instance.clazz());
|
| + Function& function =
|
| + Function::Handle(instance_class.LookupDynamicFunction(function_name));
|
| + while (function.IsNull()) {
|
| + instance_class = instance_class.SuperClass();
|
| + if (instance_class.IsNull()) break;
|
| + function = instance_class.LookupDynamicFunction(function_name);
|
| + }
|
| + if (!function.IsNull()) {
|
| + String& tmp = String::Handle();
|
| + String& extra_message = String::Handle();
|
| + tmp = String::NewSymbol("\nFound '");
|
| + extra_message = String::Concat(tmp, function_name);
|
| + tmp = String::NewSymbol("(");
|
| + extra_message = String::Concat(extra_message, tmp);
|
| + const int total_num_paramaters =
|
| + function.num_fixed_parameters() + function.num_optional_parameters();
|
| + // 0 is the receiver ('this'), skip it.
|
| + for (int i = 1; i < total_num_paramaters; i++) {
|
| + if (i > 1) {
|
| + tmp = String::NewSymbol(", ");
|
| + extra_message = String::Concat(extra_message, tmp);
|
| + }
|
| + tmp = function.ParameterNameAt(i);
|
| + extra_message = String::Concat(extra_message, tmp);
|
| + }
|
| + tmp = String::NewSymbol(")'");
|
| + extra_message = String::Concat(extra_message, tmp);
|
| + dart_arguments.Add(&extra_message);
|
| + }
|
| Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
|
| }
|
|
|
|
|