diff --git a/prism_compile.c b/prism_compile.c index 3be1997eb7..a0312625fa 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -2397,9 +2397,9 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, PM_COMPILE(splat_node->expression); } - ADD_INSN1(ret, &dummy_line_node, splatarray, Qtrue); - - PM_POP_IF_POPPED; + if (!popped) { + ADD_INSN1(ret, &dummy_line_node, splatarray, Qtrue); + } return; } case PM_STATEMENTS_NODE: { diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index f94bd603ca..763ac044ba 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -325,6 +325,10 @@ module Prism test_prism_eval("[ Prism: [:b, :c]]") end + def test_SplatNode + test_prism_eval("*b = []") + end + ############################################################################ # Jumps # ############################################################################