diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-26 14:20:15 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-26 14:20:15 +0000 |
commit | d0baa0dd52fb1d72e23633bb2ba5a551957a4776 (patch) | |
tree | 545695dce21f3d2cce8ff50117a427f03795ddf3 /compile.c | |
parent | a0a2c144b8b078cea668a703e2308ea64d4eb161 (diff) | |
download | ruby-d0baa0dd52fb1d72e23633bb2ba5a551957a4776.tar.gz |
* vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments), iseq.c (rb_iseq_parameters), vm_insnhelper.c (vm_callee_setup_arg_complex): support Method#parameters for keyword arguments. The provisional spec is what Benoit Daloze proposed. [ruby-core:40518]
* test/ruby/test_keyword.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -1140,16 +1140,11 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args) node = node->nd_next; i += 1; } - if ((args->kw_rest_arg->nd_vid & ID_SCOPE_MASK) == ID_JUNK) { - iseq->arg_keywords = i; - iseq->arg_keyword_table = ALLOC_N(ID, i); - for (j = 0; j < i; j++) { - iseq->arg_keyword_table[j] = FIX2INT(RARRAY_PTR(keywords)[j]); - } - } - else { - iseq->arg_keywords = 0; - iseq->arg_keyword_table = 0; + iseq->arg_keyword_check = (args->kw_rest_arg->nd_vid & ID_SCOPE_MASK) == ID_JUNK; + iseq->arg_keywords = i; + iseq->arg_keyword_table = ALLOC_N(ID, i); + for (j = 0; j < i; j++) { + iseq->arg_keyword_table[j] = FIX2INT(RARRAY_PTR(keywords)[j]); } ADD_INSN(optargs, nd_line(args->kw_args), pop); } |