From 91afce9afa0033bf9835e70207306f3715fd69f7 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 14 Dec 2013 08:39:17 +0000 Subject: vm_insnhelper.c: post arguments as mandatory * vm_insnhelper.c (vm_callee_setup_arg_complex): count post arguments as mandatory arguments. [ruby-core:57706] [Bug #8993] * vm_insnhelper.c (vm_yield_setup_block_args): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_insnhelper.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'vm_insnhelper.c') diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 6174e13a58..08915c8b96 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1109,7 +1109,7 @@ vm_callee_setup_arg_complex(rb_thread_t *th, rb_call_info_t *ci, const rb_iseq_t /* keyword argument */ if (iseq->arg_keyword != -1) { - argc = vm_callee_setup_keyword_arg(iseq, argc, m, orig_argv, &keyword_hash); + argc = vm_callee_setup_keyword_arg(iseq, argc, min, orig_argv, &keyword_hash); } /* mandatory */ @@ -2164,6 +2164,7 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq, int i; int argc = orig_argc; const int m = iseq->argc; + const int min = m + iseq->arg_post_len; VALUE ary, arg0; VALUE keyword_hash = Qnil; int opt_pc = 0; @@ -2177,7 +2178,7 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq, */ arg0 = argv[0]; if (!(iseq->arg_simple & 0x02) && /* exclude {|a|} */ - ((m + iseq->arg_post_len) > 0 || /* positional arguments exist */ + (min > 0 || /* positional arguments exist */ iseq->arg_opts > 2 || /* multiple optional arguments exist */ iseq->arg_keyword != -1 || /* any keyword arguments */ 0) && @@ -2200,7 +2201,7 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq, /* keyword argument */ if (iseq->arg_keyword != -1) { - argc = vm_callee_setup_keyword_arg(iseq, argc, m, argv, &keyword_hash); + argc = vm_callee_setup_keyword_arg(iseq, argc, min, argv, &keyword_hash); } for (i=argc; i