summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-05-12 11:34:01 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2024-05-21 13:52:29 +0900
commitee8bbbabe549d1ff8a37509e3a5dc9e648aced3a (patch)
tree23bed19104391e195b5600e8631540e8c40648e8
parent2e765c20dbd542d43155749910421b0f7963524f (diff)
ripper: Show popped TOS in debug mode
-rw-r--r--parse.y8
1 files changed, 4 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index 7a67943567..b467c4a154 100644
--- a/parse.y
+++ b/parse.y
@@ -634,10 +634,10 @@ static void
after_reduce(int len, struct parser_params *p)
{
for (int i = 0; i < len; i++) {
+ VALUE tos = rb_ary_pop(p->s_value_stack);
if (p->debug) {
- rb_parser_printf(p, "after-reduce pop: %+"PRIsVALUE"\n", rb_ary_entry(p->s_value_stack, -1));
+ rb_parser_printf(p, "after-reduce pop: %+"PRIsVALUE"\n", tos);
}
- rb_ary_pop(p->s_value_stack);
}
if (p->debug) {
rb_parser_printf(p, "after-reduce push: %+"PRIsVALUE"\n", p->s_lvalue);
@@ -659,10 +659,10 @@ static void
after_pop_stack(int len, struct parser_params *p)
{
for (int i = 0; i < len; i++) {
+ VALUE tos = rb_ary_pop(p->s_value_stack);
if (p->debug) {
- rb_parser_printf(p, "after-pop-stack pop: %+"PRIsVALUE"\n", rb_ary_entry(p->s_value_stack, -1));
+ rb_parser_printf(p, "after-pop-stack pop: %+"PRIsVALUE"\n", tos);
}
- rb_ary_pop(p->s_value_stack);
}
}
#else