Chromium Code Reviews| Index: runtime/vm/ast.cc |
| =================================================================== |
| --- runtime/vm/ast.cc (revision 6422) |
| +++ runtime/vm/ast.cc (working copy) |
| @@ -406,7 +406,18 @@ |
| AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) { |
| - return new StaticSetterNode(token_index(), cls(), field_name(), rhs); |
| + // If no setter exist, set the field directly. |
| + const String& setter_name = String::Handle(Field::SetterName(field_name())); |
| + const Function& function = |
| + Function::ZoneHandle(cls().LookupStaticFunction(setter_name)); |
| + if (function.IsNull()) { |
| + const Field& field = Field::ZoneHandle( |
| + cls().LookupStaticField(field_name())); |
| + ASSERT(!field.IsNull()); |
|
srdjan
2012/04/11 19:52:51
Please add a comment why the field must exist.
regis
2012/04/11 21:11:24
Done. I added a comment and debugging code verifyi
|
| + return new StoreStaticFieldNode(token_index(), field, rhs); |
| + } else { |
| + return new StaticSetterNode(token_index(), cls(), field_name(), rhs); |
| + } |
| } |