| Index: runtime/vm/mirrors_api_impl.cc
|
| ===================================================================
|
| --- runtime/vm/mirrors_api_impl.cc (revision 25321)
|
| +++ runtime/vm/mirrors_api_impl.cc (working copy)
|
| @@ -342,22 +342,27 @@
|
| const Library& lib = Library::Cast(obj);
|
|
|
| // Case 1. Lookup the unmodified function name.
|
| - func = lib.LookupFunctionAllowPrivate(func_name);
|
| + String& ambiguity_error_msg = String::Handle(isolate);
|
| + func = lib.LookupFunctionAllowPrivate(func_name, &ambiguity_error_msg);
|
|
|
| // Case 2. Lookup the function without the external setter suffix
|
| // '='. Make sure to do this check after the regular lookup, so
|
| // that we don't interfere with operator lookups (like ==).
|
| - if (func.IsNull() && HasExternalSetterSuffix(func_name)) {
|
| + if (func.IsNull() && ambiguity_error_msg.IsNull() &&
|
| + HasExternalSetterSuffix(func_name)) {
|
| tmp_name = RemoveExternalSetterSuffix(func_name);
|
| tmp_name = Field::SetterName(tmp_name);
|
| - func = lib.LookupFunctionAllowPrivate(tmp_name);
|
| + func = lib.LookupFunctionAllowPrivate(tmp_name, &ambiguity_error_msg);
|
| }
|
|
|
| // Case 3. Lookup the function with the getter prefix prepended.
|
| - if (func.IsNull()) {
|
| + if (func.IsNull() && ambiguity_error_msg.IsNull()) {
|
| tmp_name = Field::GetterName(func_name);
|
| - func = lib.LookupFunctionAllowPrivate(tmp_name);
|
| + func = lib.LookupFunctionAllowPrivate(tmp_name, &ambiguity_error_msg);
|
| }
|
| + if (!ambiguity_error_msg.IsNull()) {
|
| + return Api::NewError("%s.", ambiguity_error_msg.ToCString());
|
| + }
|
| } else {
|
| return Api::NewError(
|
| "%s expects argument 'target' to be a class or library.",
|
| @@ -664,7 +669,13 @@
|
| }
|
| if (obj.IsLibrary()) {
|
| const Library& lib = Library::Cast(obj);
|
| - return Api::NewHandle(isolate, lib.LookupFieldAllowPrivate(var_name));
|
| + String& ambiguity_error_msg = String::Handle(isolate);
|
| + const Field& variable = Field::Handle(
|
| + lib.LookupFieldAllowPrivate(var_name, &ambiguity_error_msg));
|
| + if (!ambiguity_error_msg.IsNull()) {
|
| + return Api::NewError("%s.", ambiguity_error_msg.ToCString());
|
| + }
|
| + return Api::NewHandle(isolate, variable.raw());
|
| }
|
| return Api::NewError(
|
| "%s expects argument 'target' to be a class or library.",
|
|
|