Skip to content

Commit 5834a3e

Browse files
authored
Merge pull request #4111 from Earlopain/reverse-sync
Reverse sync
2 parents 0cdf579 + ce0179e commit 5834a3e

6 files changed

Lines changed: 33 additions & 37 deletions

File tree

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
@ ProgramNode (location: (1,0)-(7,1))
1+
@ ProgramNode (location: (1,0)-(11,1))
22
├── flags: ∅
33
├── locals: []
44
└── statements:
5-
@ StatementsNode (location: (1,0)-(7,1))
5+
@ StatementsNode (location: (1,0)-(11,1))
66
├── flags: ∅
7-
└── body: (length: 2)
7+
└── body: (length: 3)
88
├── @ PostExecutionNode (location: (1,0)-(3,1))
99
│ ├── flags: newline
1010
│ ├── statements:
@@ -18,16 +18,29 @@
1818
│ ├── keyword_loc: (1,0)-(1,3) = "END"
1919
│ ├── opening_loc: (1,4)-(1,5) = "{"
2020
│ └── closing_loc: (3,0)-(3,1) = "}"
21-
└── @ PostExecutionNode (location: (5,0)-(7,1))
21+
├── @ PostExecutionNode (location: (5,0)-(7,1))
22+
│ ├── flags: newline
23+
│ ├── statements:
24+
│ │ @ StatementsNode (location: (6,2)-(6,7))
25+
│ │ ├── flags: ∅
26+
│ │ └── body: (length: 1)
27+
│ │ └── @ BreakNode (location: (6,2)-(6,7))
28+
│ │ ├── flags: newline
29+
│ │ ├── arguments: ∅
30+
│ │ └── keyword_loc: (6,2)-(6,7) = "break"
31+
│ ├── keyword_loc: (5,0)-(5,3) = "END"
32+
│ ├── opening_loc: (5,4)-(5,5) = "{"
33+
│ └── closing_loc: (7,0)-(7,1) = "}"
34+
└── @ PostExecutionNode (location: (9,0)-(11,1))
2235
├── flags: newline
2336
├── statements:
24-
│ @ StatementsNode (location: (6,2)-(6,7))
37+
│ @ StatementsNode (location: (10,2)-(10,6))
2538
│ ├── flags: ∅
2639
│ └── body: (length: 1)
27-
│ └── @ BreakNode (location: (6,2)-(6,7))
40+
│ └── @ NextNode (location: (10,2)-(10,6))
2841
│ ├── flags: newline
2942
│ ├── arguments: ∅
30-
│ └── keyword_loc: (6,2)-(6,7) = "break"
31-
├── keyword_loc: (5,0)-(5,3) = "END"
32-
├── opening_loc: (5,4)-(5,5) = "{"
33-
└── closing_loc: (7,0)-(7,1) = "}"
43+
│ └── keyword_loc: (10,2)-(10,6) = "next"
44+
├── keyword_loc: (9,0)-(9,3) = "END"
45+
├── opening_loc: (9,4)-(9,5) = "{"
46+
└── closing_loc: (11,0)-(11,1) = "}"

snapshots/end_block_exit.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/prism.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5074,7 +5074,7 @@ pm_interpolated_regular_expression_node_closing_set(pm_parser_t *parser, pm_inte
50745074
* PM_NODE_FLAG_STATIC_LITERAL indicates that the node should be treated as a
50755075
* single static literal string that can be pushed onto the stack on its own.
50765076
* Note that this doesn't necessarily mean that the string will be frozen or
5077-
* not; the instructions in CRuby will be either putobject or putstring,
5077+
* not; the instructions in CRuby will be either either putobject, dupstring or dupchilledstring,
50785078
* depending on the combination of `--enable-frozen-string-literal`,
50795079
* `# frozen_string_literal: true`, and whether or not there is interpolation.
50805080
*
@@ -15332,9 +15332,6 @@ parse_block_exit(pm_parser_t *parser, pm_node_t *node) {
1533215332
if (parser->version < PM_OPTIONS_VERSION_CRUBY_4_1) {
1533315333
return;
1533415334
}
15335-
if (PM_NODE_TYPE_P(node, PM_NEXT_NODE)) {
15336-
return;
15337-
}
1533815335
}
1533915336
PRISM_FALLTHROUGH
1534015337
case PM_CONTEXT_DEF:

test/prism/errors/4.1/end_block_exit.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ END {
33
^~~~~ Invalid break
44
}
55

6+
END {
7+
next
8+
^~~~ Invalid next
9+
}
10+

test/prism/fixtures/3.3-4.0/end_block_exit.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ END {
55
END {
66
break
77
}
8+
9+
END {
10+
next
11+
}

test/prism/fixtures/end_block_exit.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)