summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazuki Yamaguchi <[email protected]>2024-12-20 15:37:10 +0900
committerKevin Newton <[email protected]>2024-12-20 08:19:09 -0500
commit0397bfa2c83f442cb46dd0219d30c52aa7ff6d16 ()
treee1192eba82e71547d9c388a8952934e64994200b
parentb53a75230feb1db64320545ae45514ebd8d4c535 (diff)
[PRISM] Fix compiling popped opt_str_uminus and opt_str_freeze
Put a pop as needed. This example currently causes [BUG]: $ ruby --parser=prism -e'1.times{"".freeze;nil}' -e:1: [BUG] Stack consistency error (sp: 15, bp: 14) ruby 3.4.0dev (2024-12-20T00:48:01Z master 978df259ca) +PRISM [x86_64-linux]
Notes: Merged: https://.com/ruby/ruby/pull/12410
-rw-r--r--prism_compile.c2
-rw-r--r--test/ruby/test_compile_prism.rb4
2 files changed, 6 insertions, 0 deletions
@@ -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);
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);
return;
}
break;
@@ -1993,6 +1993,10 @@ end
end
test_prism_call_node
CODE
end
def test_CallAndWriteNode