summaryrefslogtreecommitdiff
path: root/prism
diff options
context:
space:
mode:
authorTSUYUSATO Kitsune <make.just.on@gmail.com>2023-11-09 16:01:37 +0900
committergit <svn-admin@ruby-lang.org>2023-11-09 08:37:20 +0000
commitfae44d652477292ddc66c76111bdaf25f84267fe (patch)
tree8dc172de5a52c3734a3afb40160b9b23a507533f /prism
parentb73e087dbc91cf47ebff79e5eaa7a8ab2795a5e0 (diff)
[ruby/prism] Reset do_loop_stack around a body of a endless method definition
Fix https://github.com/ruby/prism/pull/1772 https://github.com/ruby/prism/commit/cdf58e845e
Diffstat (limited to 'prism')
-rw-r--r--prism/prism.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/prism/prism.c b/prism/prism.c
index a362961a1f..7689cdc95c 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -14326,6 +14326,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power) {
equal = parser->previous;
context_push(parser, PM_CONTEXT_DEF);
+ pm_do_loop_stack_push(parser, false);
statements = (pm_node_t *) pm_statements_node_create(parser);
pm_node_t *statement = parse_expression(parser, PM_BINDING_POWER_DEFINED + 1, PM_ERR_DEF_ENDLESS);
@@ -14338,6 +14339,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power) {
}
pm_statements_node_body_append((pm_statements_node_t *) statements, statement);
+ pm_do_loop_stack_pop(parser);
context_pop(parser);
end_keyword = not_provided(parser);
} else {