mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* insnhelper.ci (vm_callee_setup_arg): fix to check arguments
correctly. [ruby-dev:31472] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f72409043c
commit
2e83c555d8
2 changed files with 13 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Aug 18 13:14:40 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* insnhelper.ci (vm_callee_setup_arg): fix to check arguments
|
||||
correctly. [ruby-dev:31472]
|
||||
|
||||
Sat Aug 18 13:13:06 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* bootstraptest/test_exception.rb: add escape character ("\") for
|
||||
|
|
|
@ -103,7 +103,7 @@ vm_callee_setup_arg(rb_thread_t *th, rb_iseq_t *iseq,
|
|||
const int m = iseq->argc;
|
||||
const int orig_argc = argc;
|
||||
|
||||
if (iseq->arg_simple & 0x01) {
|
||||
if (LIKELY(iseq->arg_simple & 0x01)) {
|
||||
/* simple check */
|
||||
if (argc != m) {
|
||||
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
|
||||
|
@ -136,7 +136,7 @@ vm_callee_setup_arg(rb_thread_t *th, rb_iseq_t *iseq,
|
|||
|
||||
for (i=0; i<iseq->arg_post_len; i++) {
|
||||
dst[iseq->arg_post_start + iseq->arg_post_len - (i + 1)] = argv[argc - 1];
|
||||
argc = argc - 1;
|
||||
argc--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,7 @@ vm_callee_setup_arg(rb_thread_t *th, rb_iseq_t *iseq,
|
|||
/* rest arguments */
|
||||
if (iseq->arg_rest != -1) {
|
||||
dst[iseq->arg_rest] = rb_ary_new4(argc, argv);
|
||||
argc = 0;
|
||||
}
|
||||
|
||||
/* block arguments */
|
||||
|
@ -169,6 +170,11 @@ vm_callee_setup_arg(rb_thread_t *th, rb_iseq_t *iseq,
|
|||
VALUE blockval = Qnil;
|
||||
rb_block_t * const blockptr = *block;
|
||||
|
||||
if (argc != 0) {
|
||||
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
|
||||
orig_argc, m + iseq->arg_post_len);
|
||||
}
|
||||
|
||||
if (blockptr) {
|
||||
/* make Proc object */
|
||||
if (blockptr->proc == 0) {
|
||||
|
|
Loading…
Reference in a new issue