merge revision(s) 57733,57734: [Backport #13782]

kwrest arg name

	* compile.c (iseq_set_arguments_keywords): make keyword rest
	  argument name nd_vid consistently, regardless of whether other
	  keyword arguments are present.  [Fix GH-1529]

	* parse.y (new_args_tail_gen): ditto.

	fix nd_ainfo->kw_rest_arg

	[Fix GH-5129]
	Author:    fate0 <fate0@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2018-02-16 16:40:57 +00:00
parent eaba9da1d1
commit 4828fe38d9
4 changed files with 7 additions and 7 deletions

View file

@ -1307,7 +1307,7 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
iseq->body->param.flags.has_kw = TRUE; iseq->body->param.flags.has_kw = TRUE;
iseq->body->param.keyword = keyword = ZALLOC_N(struct rb_iseq_param_keyword, 1); iseq->body->param.keyword = keyword = ZALLOC_N(struct rb_iseq_param_keyword, 1);
keyword->bits_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid); keyword->bits_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_cflag);
while (node) { while (node) {
NODE *val_node = node->nd_body->nd_value; NODE *val_node = node->nd_body->nd_value;
@ -1346,8 +1346,8 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
keyword->num = kw; keyword->num = kw;
if (args->kw_rest_arg->nd_cflag != 0) { if (args->kw_rest_arg->nd_vid != 0) {
keyword->rest_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_cflag); keyword->rest_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid);
iseq->body->param.flags.has_kwrest = TRUE; iseq->body->param.flags.has_kwrest = TRUE;
} }
keyword->required_num = rkw; keyword->required_num = rkw;

2
node.c
View file

@ -961,8 +961,8 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
F_ID(nd_ainfo->rest_arg, "rest argument"); F_ID(nd_ainfo->rest_arg, "rest argument");
F_ID(nd_ainfo->block_arg, "block argument"); F_ID(nd_ainfo->block_arg, "block argument");
F_NODE(nd_ainfo->opt_args, "optional arguments"); F_NODE(nd_ainfo->opt_args, "optional arguments");
LAST_NODE;
F_NODE(nd_ainfo->kw_args, "keyword arguments"); F_NODE(nd_ainfo->kw_args, "keyword arguments");
LAST_NODE;
F_NODE(nd_ainfo->kw_rest_arg, "keyword rest argument"); F_NODE(nd_ainfo->kw_rest_arg, "keyword rest argument");
break; break;

View file

@ -10127,8 +10127,8 @@ new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b)
if (kr) arg_var(kr); if (kr) arg_var(kr);
if (b) arg_var(b); if (b) arg_var(b);
args->kw_rest_arg = NEW_DVAR(kw_bits); args->kw_rest_arg = NEW_DVAR(kr);
args->kw_rest_arg->nd_cflag = kr; args->kw_rest_arg->nd_cflag = kw_bits;
} }
else if (kr) { else if (kr) {
if (b) vtable_pop(lvtbl->args, 1); /* reorder */ if (b) vtable_pop(lvtbl->args, 1); /* reorder */

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.4" #define RUBY_VERSION "2.4.4"
#define RUBY_RELEASE_DATE "2018-02-17" #define RUBY_RELEASE_DATE "2018-02-17"
#define RUBY_PATCHLEVEL 239 #define RUBY_PATCHLEVEL 240
#define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 2 #define RUBY_RELEASE_MONTH 2