Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 23922) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -7525,8 +7525,23 @@ |
| ASSERT(field.value() != Object::transition_sentinel().raw()); |
| return new LiteralNode(ident_pos, Instance::ZoneHandle(field.value())); |
| } |
| - // Access the field directly. |
| - return new LoadStaticFieldNode(ident_pos, Field::ZoneHandle(field.raw())); |
| + ASSERT(field.is_static()); |
| + const Class& field_owner = Class::ZoneHandle(field.owner()); |
| + const String& field_name = String::ZoneHandle(field.name()); |
| + const String& getter_name = String::Handle(Field::GetterName(field_name)); |
| + const Function& getter = |
| + Function::Handle(field_owner.LookupStaticFunction(getter_name)); |
| + // Never load field directly if there is a getter (deterministic AST). |
| + if (getter.IsNull()) { |
| + return new LoadStaticFieldNode(ident_pos, Field::ZoneHandle(field.raw())); |
| + } else { |
| + ASSERT(getter.kind() == RawFunction::kConstImplicitGetter); |
| + return new StaticGetterNode(ident_pos, |
| + NULL, // Receiver. |
| + false, // is_super_getter. |
| + field_owner, |
| + field_name); |
| + } |
| } |
| @@ -8172,7 +8187,8 @@ |
| field_owner, |
| field_name); |
| } |
| - } else if (value.raw() == Object::sentinel().raw()) { |
| + } |
|
hausner
2013/06/12 20:43:39
Why get rid of the else? I prefer it since it is e
srdjan
2013/06/12 21:32:08
Restored.
|
| + if (value.raw() == Object::sentinel().raw()) { |
| // This field has not been referenced yet and thus the value has |
| // not been evaluated. If the field is const, call the static getter method |
| // to evaluate the expression and canonicalize the value. |