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

Unified Diff: runtime/vm/object.cc

Issue 2153143002: Rework how enums are implemented and reloaded (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/object.h ('k') | runtime/vm/object_reload.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index f629d3c7339559424838fce9c8316d1643f0d407..7bf95a0dbd29193a2ecf3dd639ef4eb369029d49 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -4199,7 +4199,8 @@ RawField* Class::LookupField(const String& name, MemberKind kind) const {
}
-RawField* Class::LookupFieldAllowPrivate(const String& name) const {
+RawField* Class::LookupFieldAllowPrivate(const String& name,
+ bool instance_only) const {
// Use slow string compare, ignoring privacy name mangling.
Thread* thread = Thread::Current();
if (EnsureIsFinalized(thread) != Error::null()) {
@@ -4217,6 +4218,10 @@ RawField* Class::LookupFieldAllowPrivate(const String& name) const {
for (intptr_t i = 0; i < len; i++) {
field ^= flds.At(i);
field_name ^= field.name();
+ if (field.is_static() && instance_only) {
+ // If we only care about instance fields, skip statics.
+ continue;
+ }
if (String::EqualsIgnoringPrivateKey(field_name, name)) {
return field.raw();
}
@@ -4226,7 +4231,7 @@ RawField* Class::LookupFieldAllowPrivate(const String& name) const {
RawField* Class::LookupInstanceFieldAllowPrivate(const String& name) const {
- Field& field = Field::Handle(LookupFieldAllowPrivate(name));
+ Field& field = Field::Handle(LookupFieldAllowPrivate(name, true));
if (!field.IsNull() && !field.is_static()) {
return field.raw();
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_reload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698