diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-12 13:20:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-12 13:20:50 +0000 |
commit | 34a95669dad8843e3e9a4af683682ab2f50856dd (patch) | |
tree | 165cd3bd3ed70a911853f55055bce1a86632a686 /iseq.c | |
parent | 976a3041ef38711b84c6a35db25f189d31903e38 (diff) |
required keyword arguments
* compile.c (iseq_set_arguments, iseq_compile_each): support required
keyword arguments. [ruby-core:51454] [Feature #7701]
* iseq.c (rb_iseq_parameters): ditto.
* parse.y (f_kw, f_block_kw): ditto. this syntax is still
experimental, the notation may change.
* vm_core.h (rb_iseq_struct): ditto.
* vm_insnhelper.c (vm_callee_setup_keyword_arg): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1965,8 +1965,20 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc) } } if (iseq->arg_keyword != -1) { + i = 0; + if (iseq->arg_keyword_required) { + ID keyreq; + CONST_ID(keyreq, "keyreq"); + for (; i < iseq->arg_keyword_required; i++) { + PARAM_TYPE(keyreq); + if (rb_id2str(iseq->arg_keyword_table[i])) { + rb_ary_push(a, ID2SYM(iseq->arg_keyword_table[i])); + } + rb_ary_push(args, a); + } + } CONST_ID(key, "key"); - for (i = 0; i < iseq->arg_keywords; i++) { + for (; i < iseq->arg_keywords; i++) { PARAM_TYPE(key); if (rb_id2str(iseq->arg_keyword_table[i])) { rb_ary_push(a, ID2SYM(iseq->arg_keyword_table[i])); |