Skip to content

Commit

Permalink
Disallow infix after multi-write except modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Sep 30, 2024
1 parent 919c1b4 commit b8d2117
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 b8d2117

Please sign in to comment.