summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-04 14:30:28 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-04 14:30:28 +0000
commit2392c12bd183241e8d255aa882f53ebd845b7dd8 (patch)
treeffbae09c1170acbed50ed39900ba20048b3283c6 /vm_insnhelper.c
parente377d3bb755f5126dce2e655e3469a13e1ed885c (diff)
merge revision(s) 40992: [Backport #8040]
* vm_insnhelper.c (vm_callee_setup_keyword_arg, vm_callee_setup_arg_complex): consider a hash argument for keyword only when the number of arguments is more than the expected mandatory parameters. [ruby-core:53199] [ruby-trunk - Bug #8040] * test/ruby/test_keyword.rb: update a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 0c52774ca8..769e6c6c23 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1091,12 +1091,12 @@ extract_keywords(VALUE *orighash)
}
static inline int
-vm_callee_setup_keyword_arg(const rb_iseq_t *iseq, int argc, VALUE *orig_argv, VALUE *kwd)
+vm_callee_setup_keyword_arg(const rb_iseq_t *iseq, int argc, int m, VALUE *orig_argv, VALUE *kwd)
{
VALUE keyword_hash, orig_hash;
int i, j;
- if (argc > 0 &&
+ if (argc > m &&
!NIL_P(orig_hash = rb_check_hash_type(orig_argv[argc-1])) &&
(keyword_hash = extract_keywords(&orig_hash)) != 0) {
if (!orig_hash) {
@@ -1140,7 +1140,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, orig_argv, &keyword_hash);
+ argc = vm_callee_setup_keyword_arg(iseq, argc, m, orig_argv, &keyword_hash);
}
/* mandatory */
@@ -2168,7 +2168,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, argv, &keyword_hash);
+ argc = vm_callee_setup_keyword_arg(iseq, argc, m, argv, &keyword_hash);
}
/*