diff --git a/prism_compile.c b/prism_compile.c index d9c2038081..c15725c7ab 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -6913,6 +6913,7 @@ pm_compile_call_node(rb_iseq_t *iseq, const pm_call_node_t *node, LINK_ANCHOR *c VALUE value = parse_static_literal_string(iseq, scope_node, node->receiver, &((const pm_string_node_t * ) node->receiver)->unescaped); const struct rb_callinfo *callinfo = new_callinfo(iseq, idUMinus, 0, 0, NULL, FALSE); PUSH_INSN2(ret, location, opt_str_uminus, value, callinfo); + if (popped) PUSH_INSN(ret, location, pop); return; } break; @@ -6922,6 +6923,7 @@ pm_compile_call_node(rb_iseq_t *iseq, const pm_call_node_t *node, LINK_ANCHOR *c VALUE value = parse_static_literal_string(iseq, scope_node, node->receiver, &((const pm_string_node_t * ) node->receiver)->unescaped); const struct rb_callinfo *callinfo = new_callinfo(iseq, idFreeze, 0, 0, NULL, FALSE); PUSH_INSN2(ret, location, opt_str_freeze, value, callinfo); + if (popped) PUSH_INSN(ret, location, pop); return; } break; diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 25f098f562..d182549b13 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1993,6 +1993,10 @@ end end test_prism_call_node CODE + + # Specialized instructions + assert_prism_eval(%{-"literal"}) + assert_prism_eval(%{"literal".freeze}) end def test_CallAndWriteNode