ruby-changes:45660
From: nobu <ko1@a...>
Date: Mon, 27 Feb 2017 22:52:13 +0900 (JST)
Subject: [ruby-changes:45660] nobu:r57733 (trunk): kwrest arg name
nobu 2017-02-27 22:52:07 +0900 (Mon, 27 Feb 2017) New Revision: 57733 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57733 Log: 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. Modified files: trunk/compile.c trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 57732) +++ parse.y (revision 57733) @@ -9920,8 +9920,8 @@ new_args_tail_gen(struct parser_params * https://github.com/ruby/ruby/blob/trunk/parse.y#L9920 if (kr) arg_var(kr); if (b) arg_var(b); - args->kw_rest_arg = NEW_DVAR(kw_bits); - args->kw_rest_arg->nd_cflag = kr; + args->kw_rest_arg = NEW_DVAR(kr); + args->kw_rest_arg->nd_cflag = kw_bits; } else if (kr) { if (b) vtable_pop(lvtbl->args, 1); /* reorder */ Index: compile.c =================================================================== --- compile.c (revision 57732) +++ compile.c (revision 57733) @@ -1307,7 +1307,7 @@ iseq_set_arguments_keywords(rb_iseq_t *i https://github.com/ruby/ruby/blob/trunk/compile.c#L1307 iseq->body->param.flags.has_kw = TRUE; 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) { NODE *val_node = node->nd_body->nd_value; @@ -1346,8 +1346,8 @@ iseq_set_arguments_keywords(rb_iseq_t *i https://github.com/ruby/ruby/blob/trunk/compile.c#L1346 keyword->num = kw; - if (args->kw_rest_arg->nd_cflag != 0) { - keyword->rest_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_cflag); + if (args->kw_rest_arg->nd_vid != 0) { + keyword->rest_start = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid); iseq->body->param.flags.has_kwrest = TRUE; } keyword->required_num = rkw; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/