summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-14 08:39:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-14 08:39:17 +0000
commit91afce9afa0033bf9835e70207306f3715fd69f7 (patch)
tree42b7207677bcc02abde33716258e2e25cfcf06e6 /vm_insnhelper.c
parent1ec457c2ff6c52f16eab408cc4e4990414fff940 (diff)
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
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c7
1 files changed, 4 insertions, 3 deletions
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<m; i++) {