diff options
author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-07 10:08:16 -0500 |
---|---|---|
committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-07 10:34:39 -0500 |
commit | b8df6b9e01d8971235ea42fc9098ce392f791928 (patch) | |
tree | 04acf865693f8a6d287bfd043af23babbf613b09 /prism_compile.c | |
parent | cbc0e0bef08f9389f5bbe76de016795f01c3bc76 (diff) | |
download | ruby-b8df6b9e01d8971235ea42fc9098ce392f791928.tar.gz |
[PRISM] Don't pop arguments on a return node
Since ReturnNodes don't get popped, their arguments shouldn't either
Diffstat (limited to 'prism_compile.c')
-rw-r--r-- | prism_compile.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/prism_compile.c b/prism_compile.c index 1371ef9c5a..e5a82b37e1 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -3941,7 +3941,6 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, if (iseq) { enum rb_iseq_type type = ISEQ_BODY(iseq)->type; - const NODE *retval = RNODE_RETURN(node)->nd_stts; LABEL *splabel = 0; const rb_iseq_t *parent_iseq = iseq; @@ -3954,7 +3953,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, switch (parent_type) { case ISEQ_TYPE_TOP: case ISEQ_TYPE_MAIN: - if (retval) { + if (arguments) { rb_warn("argument of top-level return is ignored"); } if (parent_iseq == iseq) { @@ -3972,7 +3971,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } if (arguments) { - PM_COMPILE((pm_node_t *)arguments); + PM_COMPILE_NOT_POPPED((pm_node_t *)arguments); } else { PM_PUTNIL; |