Skip to content

Commit

Permalink
Merge pull request #3113 from ruby/disallow-joiners-after-multi-write
Browse files Browse the repository at this point in the history
Disallow infix after multi-write except modifiers
  • Loading branch information
kddnewton authored Oct 1, 2024
2 parents 919c1b4 + b8d2117 commit 7508c71
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -21642,6 +21642,13 @@ parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool acc
node = parse_expression_infix(parser, node, binding_power, current_binding_powers.right, accepts_command_call, (uint16_t) (depth + 1));

switch (PM_NODE_TYPE(node)) {
case PM_MULTI_WRITE_NODE:
// Multi-write nodes are statements, and cannot be followed by
// operators except modifiers.
if (pm_binding_powers[parser->current.type].left > PM_BINDING_POWER_MODIFIER) {
return node;
}
break;
case PM_CLASS_VARIABLE_WRITE_NODE:
case PM_CONSTANT_PATH_WRITE_NODE:
case PM_CONSTANT_WRITE_NODE:
Expand Down

0 comments on commit 7508c71

Please sign in to comment.