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

Unified Diff: runtime/vm/object.cc

Issue 1090373006: Properly resolve top-level setters (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 45315)
+++ runtime/vm/object.cc (working copy)
@@ -9343,6 +9343,7 @@
String& import_lib_url = String::Handle();
String& first_import_lib_url = String::Handle();
Object& found_obj = Object::Handle();
+ String& found_obj_name = String::Handle();
for (intptr_t i = 0; i < num_imports(); i++) {
import ^= ImportAt(i);
obj = import.Lookup(name);
@@ -9358,13 +9359,28 @@
// from the Dart library.
first_import_lib_url = import_lib.url();
found_obj = obj.raw();
+ found_obj_name = obj.DictionaryName();
} else if (import_lib_url.StartsWith(Symbols::DartScheme())) {
// The newly found object is exported from a Dart system
// library. It is hidden by the previously found object.
// We continue to search.
} else {
// We found two different objects with the same name.
- return Object::null();
+ // Note that we need to compare the names again because
+ // looking up an unmangled name can return a getter or a
+ // setter. A getter name is the same as the unmangled name,
+ // but a setter name is different from an unmangled name or a
+ // getter name.
+ if (Field::IsGetterName(found_obj_name)) {
+ found_obj_name = Field::NameFromGetter(found_obj_name);
+ }
+ String& second_obj_name = String::Handle(obj.DictionaryName());
+ if (Field::IsGetterName(second_obj_name)) {
+ second_obj_name = Field::NameFromGetter(second_obj_name);
+ }
+ if (found_obj_name.Equals(second_obj_name)) {
+ return Object::null();
+ }
}
}
}
@@ -10337,7 +10353,7 @@
if (Field::IsGetterName(name)) {
filter_name = &String::Handle(Field::NameFromGetter(name));
} else if (Field::IsSetterName(name)) {
- filter_name = &String::Handle(Field::NameFromGetter(name));
+ filter_name = &String::Handle(Field::NameFromSetter(name));
} else {
if (obj.IsNull() || obj.IsLibraryPrefix()) {
obj = lib.LookupEntry(String::Handle(Field::GetterName(name)), &ignore);

Powered by Google App Engine
This is Rietveld 408576698