summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-01 08:21:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-01 08:21:39 +0000
commit06c7ede25923582b7f61c85920cd195b3c0447ce (patch)
tree93c5ca55a6cc67a2d8c1e97df001589fdd114aee /vm_insnhelper.c
parent767c502252daf751a2efbd0acc5766cd5492e9fb (diff)
vm_insnhelper.c: extract keyword arguments after splat
* vm_insnhelper.c (vm_yield_setup_block_args): split single parameter if any keyword arguments exist, and then extract keyword arguments. [ruby-core:55203] [Bug #8463] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index b519670370..5a3a14d5ac 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2193,11 +2193,6 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq,
th->mark_stack_len = argc;
- /* keyword argument */
- if (iseq->arg_keyword != -1) {
- argc = vm_callee_setup_keyword_arg(iseq, argc, m, argv, &keyword_hash);
- }
-
/*
* yield [1, 2]
* => {|a|} => a = [1, 2]
@@ -2207,6 +2202,7 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq,
if (!(iseq->arg_simple & 0x02) && /* exclude {|a|} */
((m + iseq->arg_post_len) > 0 || /* positional arguments exist */
iseq->arg_opts > 2 || /* multiple optional arguments exist */
+ iseq->arg_keyword != -1 || /* any keyword arguments */
0) &&
argc == 1 && !NIL_P(ary = rb_check_array_type(arg0))) { /* rhs is only an array */
th->mark_stack_len = argc = RARRAY_LENINT(ary);
@@ -2216,6 +2212,11 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq,
MEMCPY(argv, RARRAY_PTR(ary), VALUE, argc);
}
+ /* keyword argument */
+ if (iseq->arg_keyword != -1) {
+ argc = vm_callee_setup_keyword_arg(iseq, argc, m, argv, &keyword_hash);
+ }
+
for (i=argc; i<m; i++) {
argv[i] = Qnil;
}