aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
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;
}