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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 23484020: Update handling of ambiguous name references (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/compiler_test.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 27310)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -60,7 +60,7 @@
if (obj.IsInstance()) {
const Library& core_lib = Library::Handle(Library::CoreLibrary());
const Class& list_class =
- Class::Handle(core_lib.LookupClass(Symbols::List(), NULL));
+ Class::Handle(core_lib.LookupClass(Symbols::List()));
ASSERT(!list_class.IsNull());
const Instance& instance = Instance::Cast(obj);
const Class& obj_class = Class::Handle(isolate, obj.clazz());
@@ -1073,8 +1073,7 @@
function_name,
kNumArguments,
Object::empty_array(),
- Resolver::kIsQualified,
- NULL)); // No ambiguity error expected.
+ Resolver::kIsQualified));
ASSERT(!function.IsNull());
const Array& args = Array::Handle(isolate, Array::New(kNumArguments));
args.SetAt(0, Integer::Handle(isolate, Integer::New(port_id)));
@@ -2102,7 +2101,7 @@
return ApiError::New(message);
}
const Class& cls = Class::Handle(
- isolate, lib.LookupClassAllowPrivate(class_name, NULL));
+ isolate, lib.LookupClassAllowPrivate(class_name));
ASSERT(!cls.IsNull());
Object& result = Object::Handle(isolate);
String& dot_name = String::Handle(String::New("."));
@@ -2488,7 +2487,7 @@
Library::Handle(isolate->object_store()->typed_data_library());
ASSERT(!lib.IsNull());
const Class& cls = Class::Handle(
- isolate, lib.LookupClassAllowPrivate(Symbols::ByteData(), NULL));
+ isolate, lib.LookupClassAllowPrivate(Symbols::ByteData()));
ASSERT(!cls.IsNull());
return ResolveConstructor(CURRENT_FUNC,
cls,
@@ -3082,14 +3081,9 @@
return state;
}
- String& ambiguity_error_msg = String::Handle(isolate);
Function& function = Function::Handle(isolate);
- function = lib.LookupFunctionAllowPrivate(function_name,
- &ambiguity_error_msg);
+ function = lib.LookupFunctionAllowPrivate(function_name);
if (function.IsNull()) {
- if (!ambiguity_error_msg.IsNull()) {
- return Api::NewError("%s.", ambiguity_error_msg.ToCString());
- }
return Api::NewError("%s: did not find top-level function '%s'.",
CURRENT_FUNC,
function_name.ToCString());
@@ -3248,15 +3242,13 @@
// To access a top-level we may need to use the Field or the
// getter Function. The getter function may either be in the
// library or in the field's owner class, depending.
- String& ambiguity_error_msg = String::Handle(isolate);
const Library& lib = Library::Cast(obj);
- field = lib.LookupFieldAllowPrivate(field_name, &ambiguity_error_msg);
- if (field.IsNull() && ambiguity_error_msg.IsNull()) {
+ field = lib.LookupFieldAllowPrivate(field_name);
+ if (field.IsNull()) {
// No field found and no ambiguity error. Check for a getter in the lib.
const String& getter_name =
String::Handle(isolate, Field::GetterName(field_name));
- getter = lib.LookupFunctionAllowPrivate(getter_name,
- &ambiguity_error_msg);
+ getter = lib.LookupFunctionAllowPrivate(getter_name);
} else if (!field.IsNull() && FieldIsUninitialized(isolate, field)) {
// A field was found. Check for a getter in the field's owner classs.
const Class& cls = Class::Handle(isolate, field.owner());
@@ -3273,9 +3265,6 @@
if (!field.IsNull()) {
return Api::NewHandle(isolate, field.value());
}
- if (!ambiguity_error_msg.IsNull()) {
- return Api::NewError("%s.", ambiguity_error_msg.ToCString());
- }
return Api::NewError("%s: did not find top-level variable '%s'.",
CURRENT_FUNC, field_name.ToCString());
@@ -3405,14 +3394,12 @@
// To access a top-level we may need to use the Field or the
// setter Function. The setter function may either be in the
// library or in the field's owner class, depending.
- String& ambiguity_error_msg = String::Handle(isolate);
const Library& lib = Library::Cast(obj);
- field = lib.LookupFieldAllowPrivate(field_name, &ambiguity_error_msg);
- if (field.IsNull() && ambiguity_error_msg.IsNull()) {
+ field = lib.LookupFieldAllowPrivate(field_name);
+ if (field.IsNull()) {
const String& setter_name =
String::Handle(isolate, Field::SetterName(field_name));
- setter ^= lib.LookupFunctionAllowPrivate(setter_name,
- &ambiguity_error_msg);
+ setter ^= lib.LookupFunctionAllowPrivate(setter_name);
}
if (!setter.IsNull()) {
@@ -3435,9 +3422,6 @@
field.set_value(value_instance);
return Api::Success();
}
- if (!ambiguity_error_msg.IsNull()) {
- return Api::NewError("%s.", ambiguity_error_msg.ToCString());
- }
return Api::NewError("%s: did not find top-level variable '%s'.",
CURRENT_FUNC, field_name.ToCString());
@@ -4031,13 +4015,9 @@
if (cls_name.IsNull()) {
RETURN_TYPE_ERROR(isolate, class_name, String);
}
- String& ambiguity_error_msg = String::Handle(isolate);
const Class& cls = Class::Handle(
- isolate, lib.LookupClassAllowPrivate(cls_name, &ambiguity_error_msg));
+ isolate, lib.LookupClassAllowPrivate(cls_name));
if (cls.IsNull()) {
- if (!ambiguity_error_msg.IsNull()) {
- return Api::NewError("%s.", ambiguity_error_msg.ToCString());
- }
// TODO(turnidge): Return null or error in this case?
const String& lib_name = String::Handle(isolate, lib.name());
return Api::NewError("Class '%s' not found in library '%s'.",
@@ -4068,14 +4048,9 @@
if (::Dart_IsError(state)) {
return state;
}
- String& ambiguity_error_msg = String::Handle(isolate);
const Class& cls =
- Class::Handle(isolate, lib.LookupClassAllowPrivate(name_str,
- &ambiguity_error_msg));
+ Class::Handle(isolate, lib.LookupClassAllowPrivate(name_str));
if (cls.IsNull()) {
- if (!ambiguity_error_msg.IsNull()) {
- return Api::NewError("%s.", ambiguity_error_msg.ToCString());
- }
const String& lib_name = String::Handle(isolate, lib.name());
return Api::NewError("Type '%s' not found in library '%s'.",
name_str.ToCString(), lib_name.ToCString());
« no previous file with comments | « runtime/vm/compiler_test.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698