aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-20 22:03:37 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-20 22:05:54 +0900
commite81a3e6df54842b5a836dad7055a4295cf4155bc (patch)
tree4da7dc9f6a16085c5623c3a09e5cbf768d0963c7 /compile.c
parent9e171b1fa0b4e2e5b0bf82da11b4b511c602c336 (diff)
downloadruby-e81a3e6df54842b5a836dad7055a4295cf4155bc.tar.gz
Allows calling a private method only with bare `self`
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 368a69853d..51b7b9fc3c 100644
--- a/compile.c
+++ b/compile.c
@@ -4599,7 +4599,16 @@ compile_cpath(LINK_ANCHOR *const ret, rb_iseq_t *iseq, const NODE *cpath)
}
}
-#define private_recv_p(node) (nd_type((node)->nd_recv) == NODE_SELF)
+static inline int
+private_recv_p(const NODE *node)
+{
+ if (nd_type(node->nd_recv) == NODE_SELF) {
+ NODE *self = node->nd_recv;
+ return self->nd_state != 0;
+ }
+ return 0;
+}
+
static void
defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
const NODE *const node, LABEL **lfinish, VALUE needstr);