Introduce anddot_multiple_assignment_check function

This commit is contained in:
S-H-GAMELINKS 2023-05-09 21:23:06 +09:00 committed by Nobuyoshi Nakada
parent cee6903763
commit b632566f7e
Notes: git 2023-05-14 01:32:45 +00:00

16
parse.y
View File

@ -710,6 +710,14 @@ parser_get_node_id(struct parser_params *p)
return node_id;
}
static void
anddot_multiple_assignment_check(struct parser_params* p, const YYLTYPE *loc, ID id)
{
if (id == tANDDOT) {
yyerror1(loc, "&. inside multiple assignment destination");
}
}
#ifndef RIPPER
static inline void
set_line_body(NODE *body, int line)
@ -2386,9 +2394,7 @@ mlhs_node : user_variable
}
| primary_value call_op tIDENTIFIER
{
if ($2 == tANDDOT) {
yyerror1(&@2, "&. inside multiple assignment destination");
}
anddot_multiple_assignment_check(p, &@2, $2);
/*%%%*/
$$ = attrset(p, $1, $2, $3, &@$);
/*% %*/
@ -2403,9 +2409,7 @@ mlhs_node : user_variable
}
| primary_value call_op tCONSTANT
{
if ($2 == tANDDOT) {
yyerror1(&@2, "&. inside multiple assignment destination");
}
anddot_multiple_assignment_check(p, &@2, $2);
/*%%%*/
$$ = attrset(p, $1, $2, $3, &@$);
/*% %*/