diff options
| author | Matt Valentine-House <matt@eightbitraptor.com> | 2023-12-12 16:23:50 +0000 |
|---|---|---|
| committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-12-12 13:46:36 -0500 |
| commit | 43ede3f26cda8c2a4dfbce9a44b0b6aa06281cd7 (patch) | |
| tree | 4a26a7e340415eb469c2b8fe7245bc03249383d5 | |
| parent | d1cf793adce7f797a3cd03594c539729c0099ec8 (diff) | |
[PRISM] Compile NextNode arguments
| -rw-r--r-- | prism_compile.c | 10 | ||||
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 9 |
2 files changed, 18 insertions, 1 deletions
diff --git a/prism_compile.c b/prism_compile.c index f1f70a9b63..2f0161fb47 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -2219,7 +2219,9 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } } ADD_LABEL(ret, eend); - PM_NOP; + if (!popped) { + PM_NOP; + } pm_statements_node_t *statements = begin_node->ensure_clause->statements; if (statements) { PM_COMPILE((pm_node_t *)statements); @@ -3919,6 +3921,12 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, ADD_LABEL(ret, splabel); + if (next_node->arguments) { + PM_COMPILE_NOT_POPPED((pm_node_t *)next_node->arguments); + } + else { + PM_PUTNIL; + } pm_add_ensure_iseq(ret, iseq, 0, src, scope_node); ADD_ADJUST(ret, &dummy_line_node, ISEQ_COMPILE_DATA(iseq)->redo_label); diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 05db94227e..e95baf5d5c 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -902,6 +902,15 @@ module Prism end while i < 5 res CODE + + assert_prism_eval(<<-CODE) + while false + begin + ensure + end + next + end + CODE end def test_RedoNode |
