summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-06-04 23:11:38 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-06-04 23:17:18 +0900
commit0872ea53303499caf3584e40f2a5438e86eb4fed (patch)
tree5f855704bd7f6a7d8cfa182fc19821ec7ab5cfa8 /parse.y
parent39eae6bf89773ef830b632c02737545ab9eedd35 (diff)
node.h: Avoid a magic number to represent excessed comma
`(ID)1` was assigned to NODE_ARGS#rest_arg for `{|x,| }`. This change removes the magic number by introducing an explicit macro variable for it: NODE_SPECIAL_EXCESSED_COMMA.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 2 insertions, 6 deletions
diff --git a/parse.y b/parse.y
index a35b526ab3..4446a29fa3 100644
--- a/parse.y
+++ b/parse.y
@@ -325,10 +325,6 @@ static int parser_yyerror(struct parser_params*, const YYLTYPE *yylloc, const ch
#define lambda_beginning_p() (p->lex.lpar_beg == p->lex.paren_nest)
-#ifndef RIPPER
-static const ID excessed_comma = 1;
-#endif
-
static enum yytokentype yylex(YYSTYPE*, YYLTYPE*, struct parser_params*);
#ifndef RIPPER
@@ -3261,7 +3257,7 @@ block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail
{
/*%%%*/
/* magic number for rest_id in iseq_set_arguments() */
- $$ = new_args(p, $1, Qnone, excessed_comma, Qnone, new_args_tail(p, Qnone, Qnone, Qnone, &@1), &@$);
+ $$ = new_args(p, $1, Qnone, NODE_SPECIAL_EXCESSED_COMMA, Qnone, new_args_tail(p, Qnone, Qnone, Qnone, &@1), &@$);
/*% %*/
/*% ripper: new_args(p, $1, Qnone, excessed_comma!, Qnone, new_args_tail(p, Qnone, Qnone, Qnone, NULL), NULL) %*/
}
@@ -11134,7 +11130,7 @@ args_with_numbered(struct parser_params *p, NODE *args, int max_numparam)
if (max_numparam > 0) {
if (!args) args = new_args_tail(p, 0, 0, 0, 0);
args->nd_ainfo->pre_args_num = max_numparam;
- args->nd_ainfo->rest_arg = excessed_comma;
+ args->nd_ainfo->rest_arg = NODE_SPECIAL_EXCESSED_COMMA;
}
return args;
}