summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-25 03:21:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-25 03:21:12 +0000
commit97e37d6805042175805d04a654d423422f670281 (patch)
tree1254864d2eea9c2c81cd5a57532c177b4424bf01
parente7ce17cfe83e377b5a8748c01286fe4b8c8a03a1 (diff)
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--compile.c15
2 files changed, 9 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index e9822ee..cd7e885 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 25 12:21:11 2014 Santiago Pastorino <santiago@wyeworks.com>
+
+ * 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@segment7.net>
* doc/keywords.rdoc: [DOC] Describe each keyword.
diff --git a/compile.c b/compile.c
index a777510..051b369 100644
--- a/compile.c
+++ b/compile.c
@@ -2899,17 +2899,10 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
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_ANCHOR *ret,
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);