diff options
| author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-11-20 11:47:54 -0500 |
|---|---|---|
| committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-11-20 12:12:34 -0800 |
| commit | c5d5929443d58d72cb9688a9fac6487ce17c1e9d (patch) | |
| tree | ca54b4b69c9bd62609e2d8a6662b4551cd71be24 | |
| parent | 307a5cb20b3e34f6a3bd240e70ddc26bd268ace3 (diff) | |
[PRISM] Don't pop args to YieldNode
| -rw-r--r-- | prism_compile.c | 2 | ||||
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/prism_compile.c b/prism_compile.c index 55920678b1..ae98ce34d0 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -3756,7 +3756,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, int argc = 0; if (yield_node->arguments) { - PM_COMPILE((pm_node_t *)yield_node->arguments); + PM_COMPILE_NOT_POPPED((pm_node_t *)yield_node->arguments); argc = (int) yield_node->arguments->arguments.size; } diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 269b6953ca..81b62cf832 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -732,6 +732,10 @@ module Prism def test_YieldNode assert_prism_eval("def prism_test_yield_node; yield; end") assert_prism_eval("def prism_test_yield_node; yield 1, 2; end") + + # Test case where there's a call directly after the yield call + assert_prism_eval("def prism_test_yield_node; yield; 1; end") + assert_prism_eval("def prism_test_yield_node; yield 1, 2; 1; end") end ############################################################################ |
