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

Unified Diff: runtime/vm/ast.cc

Issue 1055703005: Cleanup obsolete setter code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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/vm/ast.h ('k') | runtime/vm/ast_transformer.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 45120)
+++ runtime/vm/ast.cc (working copy)
@@ -559,9 +559,7 @@
AstNode* StaticGetterNode::MakeAssignmentNode(AstNode* rhs) {
- const String& setter_name = String::Handle(Field::SetterName(field_name()));
-
- if (is_super_getter_) {
+ if (is_super_getter()) {
ASSERT(receiver() != NULL);
// If the static setter is not found in the superclass, noSuchMethod will be
// called at runtime.
@@ -571,9 +569,10 @@
field_name(),
rhs);
}
+
const Function& setter =
- Function::ZoneHandle(cls().LookupStaticFunction(setter_name));
- if (!setter.IsNull()) {
+ Function::Handle(cls().LookupSetterFunction(field_name()));
+ if (!setter.IsNull() && setter.IsStaticFunction()) {
return new StaticSetterNode(token_pos(), NULL, cls(), field_name(), rhs);
}
// Could not find a static setter. Look for a field.
@@ -604,14 +603,8 @@
}
return new StoreStaticFieldNode(token_pos(), field, rhs);
}
- // Didn't find a static setter or a static field.
- // If this static getter is in an instance function where
- // a receiver is available, we turn this static getter
- // into an instance setter (and will get an error at runtime if an
- // instance setter cannot be found either).
- if (receiver() != NULL) {
- return new InstanceSetterNode(token_pos(), receiver(), field_name(), rhs);
- }
+ // Didn't find a static setter or a static field. Make a call to
+ // the non-existent setter to trigger a NoSuchMethodError at runtime.
return new StaticSetterNode(token_pos(), NULL, cls(), field_name(), rhs);
}
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/ast_transformer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698