summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-04-02 14:44:27 -0400
committerKevin Newton <kddnewton@gmail.com>2024-04-03 17:34:12 -0400
commit7ddf093588c3af1be27a24c232a626fa70f07cca (patch)
tree30afdefd9933e737a71477115f8f5ef39b1c6464
parent664a5082cb7aa961f88e2b1e71917fc508599022 (diff)
[ruby/prism] Allow block exits from while/until/for
https://github.com/ruby/prism/commit/bc46306b9b
-rw-r--r--prism/prism.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/prism/prism.c b/prism/prism.c
index 88237c654d..b4795317da 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -15712,9 +15712,12 @@ parse_block_exit(pm_parser_t *parser, const pm_token_t *token) {
switch (context_node->context) {
case PM_CONTEXT_BLOCK_BRACES:
case PM_CONTEXT_BLOCK_KEYWORDS:
+ case PM_CONTEXT_FOR:
case PM_CONTEXT_LAMBDA_BRACES:
case PM_CONTEXT_LAMBDA_DO_END:
case PM_CONTEXT_POSTEXE:
+ case PM_CONTEXT_UNTIL:
+ case PM_CONTEXT_WHILE:
// These are the good cases. We're allowed to have a block exit
// in these contexts.
return;
@@ -15744,7 +15747,6 @@ parse_block_exit(pm_parser_t *parser, const pm_token_t *token) {
case PM_CONTEXT_ELSIF:
case PM_CONTEXT_EMBEXPR:
case PM_CONTEXT_ENSURE:
- case PM_CONTEXT_FOR:
case PM_CONTEXT_FOR_INDEX:
case PM_CONTEXT_IF:
case PM_CONTEXT_PARENS:
@@ -15752,8 +15754,6 @@ parse_block_exit(pm_parser_t *parser, const pm_token_t *token) {
case PM_CONTEXT_RESCUE_ELSE:
case PM_CONTEXT_RESCUE:
case PM_CONTEXT_UNLESS:
- case PM_CONTEXT_UNTIL:
- case PM_CONTEXT_WHILE:
// In these contexts we should continue walking up the list of
// contexts.
break;