diff options
author | S-H-GAMELINKS <gamelinks007@gmail.com> | 2023-05-09 21:23:06 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-05-14 10:32:25 +0900 |
commit | b632566f7efa758ece6963dcc8b4f3674a39b8d1 (patch) | |
tree | aecc2d1007ad21f3f8a1fe6dd48e140b464f3d71 | |
parent | cee6903763074ac711875b11e544e726e17f195f (diff) | |
download | ruby-b632566f7efa758ece6963dcc8b4f3674a39b8d1.tar.gz |
Introduce anddot_multiple_assignment_check function
-rw-r--r-- | parse.y | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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, &@$); /*% %*/ |