diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-09-20 22:03:37 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-09-20 22:05:54 +0900 |
commit | e81a3e6df54842b5a836dad7055a4295cf4155bc (patch) | |
tree | 4da7dc9f6a16085c5623c3a09e5cbf768d0963c7 /compile.c | |
parent | 9e171b1fa0b4e2e5b0bf82da11b4b511c602c336 (diff) | |
download | ruby-e81a3e6df54842b5a836dad7055a4295cf4155bc.tar.gz |
Allows calling a private method only with bare `self`
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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); |