diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-31 15:00:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-31 15:00:37 +0000 |
commit | 67c574736912003c377218153f9d3b9c0c96a17b (patch) | |
tree | 558aea841613b06f6913d1ab22942aecc531a317 /compile.c | |
parent | 4a6f7633303f2d6eb5ec164dc656cf5d47531960 (diff) |
Method reference operator
Introduce the new operator for method reference, `.:`.
[Feature #12125] [Feature #13581]
[EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -4583,9 +4583,11 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, case NODE_OPCALL: case NODE_VCALL: case NODE_FCALL: + case NODE_METHREF: case NODE_ATTRASGN:{ const int explicit_receiver = (type == NODE_CALL || type == NODE_OPCALL || + type == NODE_METHREF || (type == NODE_ATTRASGN && !private_recv_p(node))); if (!lfinish[1] && (node->nd_args || explicit_receiver)) { @@ -7552,6 +7554,10 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in } break; } + case NODE_METHREF: + CHECK(COMPILE_(ret, "receiver", node->nd_recv, popped)); + ADD_ELEM(ret, &new_insn_body(iseq, line, BIN(methodref), 1, ID2SYM(node->nd_mid))->link); + break; default: UNKNOWN_NODE("iseq_compile_each", node, COMPILE_NG); ng: |