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

Unified Diff: runtime/vm/parser.cc

Issue 10115005: Static members are not visible in subclasses (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 6697)
+++ runtime/vm/parser.cc (working copy)
@@ -6901,86 +6901,85 @@
return true;
}
- // Try to find the identifier in the class scope.
+ // Try to find the identifier in the class scope of the current class.
Class& cls = Class::Handle(isolate, current_class().raw());
Function& func = Function::Handle(isolate, Function::null());
Field& field = Field::Handle(isolate, Field::null());
- while (!cls.IsNull()) {
- // First check if a field exists.
- field = cls.LookupField(ident);
- if (!field.IsNull()) {
- if (node != NULL) {
- if (!field.is_static()) {
- CheckInstanceFieldAccess(ident_pos, ident);
- *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
- } else {
- *node = GenerateStaticFieldLookup(field, ident_pos);
- }
+
+ // First check if a field exists.
+ field = cls.LookupField(ident);
+ if (!field.IsNull()) {
+ if (node != NULL) {
+ if (!field.is_static()) {
+ CheckInstanceFieldAccess(ident_pos, ident);
+ *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
+ } else {
+ *node = GenerateStaticFieldLookup(field, ident_pos);
}
- return true;
}
+ return true;
+ }
- // Check if an instance/static function exists.
- func = cls.LookupFunction(ident);
- if (!func.IsNull() &&
- (func.IsDynamicFunction() || func.IsStaticFunction())) {
+ // Check if an instance/static function exists.
+ func = cls.LookupFunction(ident);
+ if (!func.IsNull() &&
+ (func.IsDynamicFunction() || func.IsStaticFunction())) {
+ if (node != NULL) {
+ *node = new PrimaryNode(ident_pos,
+ Function::ZoneHandle(isolate, func.raw()));
+ }
+ return true;
+ }
+
+ // Now check if a getter/setter method exists for it in which case
+ // it is still a field.
+ func = cls.LookupGetterFunction(ident);
+ if (!func.IsNull()) {
+ if (func.IsDynamicFunction()) {
if (node != NULL) {
- *node = new PrimaryNode(ident_pos,
- Function::ZoneHandle(isolate, func.raw()));
+ CheckInstanceFieldAccess(ident_pos, ident);
+ ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
+ *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
}
return true;
- }
-
- // Now check if a getter/setter method exists for it in which case
- // it is still a field.
- func = cls.LookupGetterFunction(ident);
- if (!func.IsNull()) {
- if (func.IsDynamicFunction()) {
- if (node != NULL) {
- CheckInstanceFieldAccess(ident_pos, ident);
- ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
- *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
- }
- return true;
- } else if (func.IsStaticFunction()) {
- if (node != NULL) {
- ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
- *node = new StaticGetterNode(ident_pos,
- Class::ZoneHandle(isolate, cls.raw()),
- ident);
- }
- return true;
+ } else if (func.IsStaticFunction()) {
+ if (node != NULL) {
+ ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
+ *node = new StaticGetterNode(ident_pos,
+ Class::ZoneHandle(isolate, cls.raw()),
+ ident);
}
+ return true;
}
- func = cls.LookupSetterFunction(ident);
- if (!func.IsNull()) {
- if (func.IsDynamicFunction()) {
- if (node != NULL) {
- // We create a getter node even though a getter doesn't exist as
- // it could be followed by an assignment which will convert it to
- // a setter node. If there is no assignment we will get an error
- // when we try to invoke the getter.
- CheckInstanceFieldAccess(ident_pos, ident);
- ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
- *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
- }
- return true;
- } else if (func.IsStaticFunction()) {
- if (node != NULL) {
- // We create a getter node even though a getter doesn't exist as
- // it could be followed by an assignment which will convert it to
- // a setter node. If there is no assignment we will get an error
- // when we try to invoke the getter.
- *node = new StaticGetterNode(ident_pos,
- Class::ZoneHandle(isolate, cls.raw()),
- ident);
- }
- return true;
+ }
+ func = cls.LookupSetterFunction(ident);
+ if (!func.IsNull()) {
+ if (func.IsDynamicFunction()) {
+ if (node != NULL) {
+ // We create a getter node even though a getter doesn't exist as
+ // it could be followed by an assignment which will convert it to
+ // a setter node. If there is no assignment we will get an error
+ // when we try to invoke the getter.
+ CheckInstanceFieldAccess(ident_pos, ident);
+ ASSERT(AbstractType::Handle(func.result_type()).IsResolved());
+ *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
}
+ return true;
+ } else if (func.IsStaticFunction()) {
+ if (node != NULL) {
+ // We create a getter node even though a getter doesn't exist as
+ // it could be followed by an assignment which will convert it to
+ // a setter node. If there is no assignment we will get an error
+ // when we try to invoke the getter.
+ *node = new StaticGetterNode(ident_pos,
+ Class::ZoneHandle(isolate, cls.raw()),
+ ident);
+ }
+ return true;
}
-
- cls = cls.SuperClass();
}
+
+ // Nothing found in scope of current class.
if (node != NULL) {
*node = NULL;
}
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698