ruby-changes:48878
From: yui-knk <ko1@a...>
Date: Sun, 3 Dec 2017 21:27:06 +0900 (JST)
Subject: [ruby-changes:48878] yui-knk:r60996 (trunk): parse.y: Fix a location of NODE_DVAR in rb_args_info
yui-knk 2017-12-03 21:27:01 +0900 (Sun, 03 Dec 2017) New Revision: 60996 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60996 Log: parse.y: Fix a location of NODE_DVAR in rb_args_info * parse.y (new_args_tail_gen): Set only a location of NODE_DVAR. e.g. The locations of the NODE_DVAR is fixed: ``` def a(k: 1, **kws) end ``` * Before ``` NODE_DVAR (line: 1, first_lineno: 1, first_column: 6, last_lineno: 1, last_column: 18) ``` * After ``` NODE_DVAR (line: 1, first_lineno: 1, first_column: 12, last_lineno: 1, last_column: 17) ``` Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 60995) +++ parse.y (revision 60996) @@ -3375,19 +3375,19 @@ f_margs : f_marg_list https://github.com/ruby/ruby/blob/trunk/parse.y#L3375 block_args_tail : f_block_kwarg ',' f_kwrest opt_f_block_arg { - $$ = new_args_tail($1, $3, $4, &@$); + $$ = new_args_tail($1, $3, $4, &@3); } | f_block_kwarg opt_f_block_arg { - $$ = new_args_tail($1, Qnone, $2, &@$); + $$ = new_args_tail($1, Qnone, $2, &@1); } | f_kwrest opt_f_block_arg { - $$ = new_args_tail(Qnone, $1, $2, &@$); + $$ = new_args_tail(Qnone, $1, $2, &@1); } | f_block_arg { - $$ = new_args_tail(Qnone, Qnone, $1, &@$); + $$ = new_args_tail(Qnone, Qnone, $1, &@1); } ; @@ -3423,7 +3423,7 @@ block_param : f_arg ',' f_block_optarg ' https://github.com/ruby/ruby/blob/trunk/parse.y#L3423 } | f_arg ',' { - $$ = new_args($1, Qnone, 1, Qnone, new_args_tail(Qnone, Qnone, Qnone, &@$)); + $$ = new_args($1, Qnone, 1, Qnone, new_args_tail(Qnone, Qnone, Qnone, &@1)); /*%%%*/ /*% dispatch1(excessed_comma, $$); @@ -4453,19 +4453,19 @@ f_arglist : '(' f_args rparen https://github.com/ruby/ruby/blob/trunk/parse.y#L4453 args_tail : f_kwarg ',' f_kwrest opt_f_block_arg { - $$ = new_args_tail($1, $3, $4, &@$); + $$ = new_args_tail($1, $3, $4, &@3); } | f_kwarg opt_f_block_arg { - $$ = new_args_tail($1, Qnone, $2, &@$); + $$ = new_args_tail($1, Qnone, $2, &@1); } | f_kwrest opt_f_block_arg { - $$ = new_args_tail(Qnone, $1, $2, &@$); + $$ = new_args_tail(Qnone, $1, $2, &@1); } | f_block_arg { - $$ = new_args_tail(Qnone, Qnone, $1, &@$); + $$ = new_args_tail(Qnone, Qnone, $1, &@1); } ; @@ -10711,7 +10711,7 @@ new_args_gen(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L10711 } static NODE* -new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b, const YYLTYPE *location) +new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b, const YYLTYPE *kr_location) { int saved_line = ruby_sourceline; struct rb_args_info *args; @@ -10720,7 +10720,6 @@ new_args_tail_gen(struct parser_params * https://github.com/ruby/ruby/blob/trunk/parse.y#L10720 args = ZALLOC(struct rb_args_info); add_mark_object((VALUE)rb_imemo_alloc_new((VALUE)args, 0, 0, 0)); node = NEW_NODE(NODE_ARGS, 0, 0, args); - node->nd_loc = *location; if (parser->error_p) return node; args->block_arg = b; @@ -10766,14 +10765,14 @@ new_args_tail_gen(struct parser_params * https://github.com/ruby/ruby/blob/trunk/parse.y#L10765 if (kr) arg_var(kr); if (b) arg_var(b); - args->kw_rest_arg = new_dvar(kr, location); + args->kw_rest_arg = new_dvar(kr, kr_location); args->kw_rest_arg->nd_cflag = kw_bits; } else if (kr) { if (b) vtable_pop(lvtbl->args, 1); /* reorder */ arg_var(kr); if (b) arg_var(b); - args->kw_rest_arg = new_dvar(kr, location); + args->kw_rest_arg = new_dvar(kr, kr_location); } ruby_sourceline = saved_line; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/