From b632566f7efa758ece6963dcc8b4f3674a39b8d1 Mon Sep 17 00:00:00 2001 From: S-H-GAMELINKS Date: Tue, 9 May 2023 21:23:06 +0900 Subject: Introduce anddot_multiple_assignment_check function --- parse.y | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/parse.y b/parse.y index 81e4910b6e..5034bbca1e 100644 --- a/parse.y +++ b/parse.y @@ -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, &@$); /*% %*/ -- cgit v1.2.1