[ruby/prism] Switch invalid _1 targeting even on syntax error

https://github.com/ruby/prism/commit/40dec909b7
This commit is contained in:
Kevin Newton 2024-02-27 10:52:56 -05:00 committed by git
parent fc36882713
commit f67c9d001a

View File

@ -11414,12 +11414,10 @@ parse_target(pm_parser_t *parser, pm_node_t *target) {
target->type = PM_GLOBAL_VARIABLE_TARGET_NODE;
return target;
case PM_LOCAL_VARIABLE_READ_NODE:
if (pm_token_is_numbered_parameter(target->location.start, target->location.end)) {
PM_PARSER_ERR_NODE_FORMAT(parser, target, PM_ERR_PARAMETER_NUMBERED_RESERVED, target->location.start);
} else {
assert(sizeof(pm_local_variable_target_node_t) == sizeof(pm_local_variable_read_node_t));
target->type = PM_LOCAL_VARIABLE_TARGET_NODE;
}
pm_refute_numbered_parameter(parser, target->location.start, target->location.end);
assert(sizeof(pm_local_variable_target_node_t) == sizeof(pm_local_variable_read_node_t));
target->type = PM_LOCAL_VARIABLE_TARGET_NODE;
return target;
case PM_INSTANCE_VARIABLE_READ_NODE: