Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions snapshots/3.3-4.0/end_block_exit.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@ ProgramNode (location: (1,0)-(7,1))
@ ProgramNode (location: (1,0)-(11,1))
├── flags: ∅
├── locals: []
└── statements:
@ StatementsNode (location: (1,0)-(7,1))
@ StatementsNode (location: (1,0)-(11,1))
├── flags: ∅
└── body: (length: 2)
└── body: (length: 3)
├── @ PostExecutionNode (location: (1,0)-(3,1))
│ ├── flags: newline
│ ├── statements:
Expand All @@ -18,16 +18,29 @@
│ ├── keyword_loc: (1,0)-(1,3) = "END"
│ ├── opening_loc: (1,4)-(1,5) = "{"
│ └── closing_loc: (3,0)-(3,1) = "}"
└── @ PostExecutionNode (location: (5,0)-(7,1))
├── @ PostExecutionNode (location: (5,0)-(7,1))
│ ├── flags: newline
│ ├── statements:
│ │ @ StatementsNode (location: (6,2)-(6,7))
│ │ ├── flags: ∅
│ │ └── body: (length: 1)
│ │ └── @ BreakNode (location: (6,2)-(6,7))
│ │ ├── flags: newline
│ │ ├── arguments: ∅
│ │ └── keyword_loc: (6,2)-(6,7) = "break"
│ ├── keyword_loc: (5,0)-(5,3) = "END"
│ ├── opening_loc: (5,4)-(5,5) = "{"
│ └── closing_loc: (7,0)-(7,1) = "}"
└── @ PostExecutionNode (location: (9,0)-(11,1))
├── flags: newline
├── statements:
│ @ StatementsNode (location: (6,2)-(6,7))
│ @ StatementsNode (location: (10,2)-(10,6))
│ ├── flags: ∅
│ └── body: (length: 1)
│ └── @ BreakNode (location: (6,2)-(6,7))
│ └── @ NextNode (location: (10,2)-(10,6))
│ ├── flags: newline
│ ├── arguments: ∅
│ └── keyword_loc: (6,2)-(6,7) = "break"
├── keyword_loc: (5,0)-(5,3) = "END"
├── opening_loc: (5,4)-(5,5) = "{"
└── closing_loc: (7,0)-(7,1) = "}"
│ └── keyword_loc: (10,2)-(10,6) = "next"
├── keyword_loc: (9,0)-(9,3) = "END"
├── opening_loc: (9,4)-(9,5) = "{"
└── closing_loc: (11,0)-(11,1) = "}"
20 changes: 0 additions & 20 deletions snapshots/end_block_exit.txt

This file was deleted.

5 changes: 1 addition & 4 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -5074,7 +5074,7 @@ pm_interpolated_regular_expression_node_closing_set(pm_parser_t *parser, pm_inte
* PM_NODE_FLAG_STATIC_LITERAL indicates that the node should be treated as a
* single static literal string that can be pushed onto the stack on its own.
* Note that this doesn't necessarily mean that the string will be frozen or
* not; the instructions in CRuby will be either putobject or putstring,
* not; the instructions in CRuby will be either either putobject, dupstring or dupchilledstring,
* depending on the combination of `--enable-frozen-string-literal`,
* `# frozen_string_literal: true`, and whether or not there is interpolation.
*
Expand Down Expand Up @@ -15332,9 +15332,6 @@ parse_block_exit(pm_parser_t *parser, pm_node_t *node) {
if (parser->version < PM_OPTIONS_VERSION_CRUBY_4_1) {
return;
}
if (PM_NODE_TYPE_P(node, PM_NEXT_NODE)) {
return;
}
}
PRISM_FALLTHROUGH
case PM_CONTEXT_DEF:
Expand Down
5 changes: 5 additions & 0 deletions test/prism/errors/4.1/end_block_exit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ END {
^~~~~ Invalid break
}

END {
next
^~~~ Invalid next
}

4 changes: 4 additions & 0 deletions test/prism/fixtures/3.3-4.0/end_block_exit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ END {
END {
break
}

END {
next
}
3 changes: 0 additions & 3 deletions test/prism/fixtures/end_block_exit.txt

This file was deleted.

Loading