ruby-changes:34851
From: nobu <ko1@a...>
Date: Fri, 25 Jul 2014 12:21:26 +0900 (JST)
Subject: [ruby-changes:34851] nobu:r46934 (trunk): compile.c: make the receiver condition cleaner
nobu 2014-07-25 12:21:12 +0900 (Fri, 25 Jul 2014) New Revision: 46934 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46934 Log: compile.c: make the receiver condition cleaner * compile.c (defined_expr): make the condition if the receiver is explicit or implicit cleaner. [fix GH-681] Modified files: trunk/ChangeLog trunk/compile.c Index: ChangeLog =================================================================== --- ChangeLog (revision 46933) +++ ChangeLog (revision 46934) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 25 12:21:11 2014 Santiago Pastorino <santiago@w...> + + * compile.c (defined_expr): make the condition if the receiver + is explicit or implicit cleaner. [fix GH-681] + Fri Jul 25 03:53:52 2014 Eric Hodel <drbrain@s...> * doc/keywords.rdoc: [DOC] Describe each keyword. Index: compile.c =================================================================== --- compile.c (revision 46933) +++ compile.c (revision 46934) @@ -2899,17 +2899,10 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L2899 case NODE_VCALL: case NODE_FCALL: case NODE_ATTRASGN:{ - int self = TRUE; + const int explicit_receiver = + (type == NODE_CALL || + (type == NODE_ATTRASGN && !private_recv_p(node))); - switch (type) { - case NODE_ATTRASGN: - if (private_recv_p(node)) break; - case NODE_CALL: - self = FALSE; - break; - default: - /* through */; - } if (!lfinish[1]) { lfinish[1] = NEW_LABEL(nd_line(node)); } @@ -2917,7 +2910,7 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L2910 defined_expr(iseq, ret, node->nd_args, lfinish, Qfalse); ADD_INSNL(ret, nd_line(node), branchunless, lfinish[1]); } - if (!self) { + if (explicit_receiver) { defined_expr(iseq, ret, node->nd_recv, lfinish, Qfalse); ADD_INSNL(ret, nd_line(node), branchunless, lfinish[1]); COMPILE(ret, "defined/recv", node->nd_recv); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/