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

Unified Diff: runtime/vm/parser.cc

Issue 1096383005: Minor refactoring of local name resolution (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 | « no previous file | no next file » | 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 45325)
+++ runtime/vm/parser.cc (working copy)
@@ -11678,31 +11678,15 @@
// Now check if a getter/setter method exists for it in which case
// it is still a field.
+ // A setter without a corresponding getter binds to the non-existing
+ // getter. (The getter could be followed by an assignment which will
+ // convert it to a setter node. If there is no assignment the non-existing
+ // getter will throw a NoSuchMethodError.)
func = cls.LookupGetterFunction(ident);
- if (!func.IsNull()) {
- if (func.IsDynamicFunction() || func.is_abstract()) {
- if (node != NULL) {
- CheckInstanceFieldAccess(ident_pos, ident);
- ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved());
- *node = CallGetter(ident_pos, LoadReceiver(ident_pos), ident);
- }
- return true;
- } else if (func.IsStaticFunction()) {
- if (node != NULL) {
- *node = new(Z) StaticGetterNode(ident_pos,
- NULL,
- Class::ZoneHandle(Z, cls.raw()),
- ident);
- }
- return true;
- }
+ if (func.IsNull()) {
+ func = cls.LookupSetterFunction(ident);
}
- func = cls.LookupSetterFunction(ident);
if (!func.IsNull()) {
- // 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.
if (func.IsDynamicFunction() || func.is_abstract()) {
if (node != NULL) {
CheckInstanceFieldAccess(ident_pos, ident);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698