Skip to content

Commit b4ba41b

Browse files
committed
Fix multiple assigns with newlines
1 parent 3f00d9f commit b4ba41b

File tree

3 files changed

+69
-38
lines changed

3 files changed

+69
-38
lines changed

src/prism.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11140,6 +11140,8 @@ static pm_node_t *
1114011140
parse_targets_validate(pm_parser_t *parser, pm_node_t *first_target, pm_binding_power_t binding_power) {
1114111141
pm_node_t *result = parse_targets(parser, first_target, binding_power);
1114211142

11143+
while (accept1(parser, PM_TOKEN_NEWLINE));
11144+
1114311145
// Ensure that we have either an = or a ) after the targets.
1114411146
if (!match2(parser, PM_TOKEN_EQUAL, PM_TOKEN_PARENTHESIS_RIGHT)) {
1114511147
pm_parser_err_node(parser, result, PM_ERR_WRITE_TARGET_UNEXPECTED);

test/prism/fixtures/patterns.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,8 @@ end
202202
foo => Object[{x:}]
203203

204204
1.then { 1 in ^_1 }
205+
206+
(
207+
a,
208+
b
209+
) = c

test/prism/snapshots/patterns.txt

Lines changed: 62 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)