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

Unified Diff: runtime/vm/ast.cc

Issue 10689083: Compile an instance setter call when a static getter is declared, but no field (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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/ast.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.cc
===================================================================
--- runtime/vm/ast.cc (revision 9375)
+++ runtime/vm/ast.cc (working copy)
@@ -334,6 +334,18 @@
const Function& setter =
Function::ZoneHandle(cls().LookupStaticFunction(setter_name));
if (setter.IsNull()) {
+ const Field& field = Field::ZoneHandle(
+ cls().LookupStaticField(field_name()));
+ if (field.IsNull()) {
+ // A static getter is declared, but no setter and no field.
+ if (receiver() != NULL) {
+ return new InstanceSetterNode(token_pos(),
+ receiver(),
+ field_name(),
+ rhs);
+ }
+ return NULL;
+ }
// Access to a lazily initialized static field that has not yet been
// initialized is compiled to a static implicit getter.
// A setter may not exist for such a field.
@@ -344,9 +356,6 @@
ASSERT(!getter.IsNull() &&
(getter.kind() == RawFunction::kConstImplicitGetter));
#endif
- const Field& field = Field::ZoneHandle(
- cls().LookupStaticField(field_name()));
- ASSERT(!field.IsNull());
return new StoreStaticFieldNode(token_pos(), field, rhs);
} else {
return new StaticSetterNode(token_pos(), cls(), field_name(), rhs);
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698