* proc.c (proc_arity): fix an arity bug ([ruby-core:11060]).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
75d28f8870
commit
f80841275d
@ -1,3 +1,7 @@
|
|||||||
|
Tue May 1 13:59:18 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* proc.c (proc_arity): fix an arity bug ([ruby-core:11060]).
|
||||||
|
|
||||||
Tue May 1 13:12:49 2007 Koichi Sasada <ko1@atdot.net>
|
Tue May 1 13:12:49 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* yarvcore.h, compile.c (set_arguments): support post arguments.
|
* yarvcore.h, compile.c (set_arguments): support post arguments.
|
||||||
|
21
proc.c
21
proc.c
@ -443,17 +443,24 @@ proc_arity(VALUE self)
|
|||||||
rb_iseq_t *iseq;
|
rb_iseq_t *iseq;
|
||||||
GetProcPtr(self, proc);
|
GetProcPtr(self, proc);
|
||||||
iseq = proc->block.iseq;
|
iseq = proc->block.iseq;
|
||||||
if (iseq && BUILTIN_TYPE(iseq) != T_NODE) {
|
if (iseq) {
|
||||||
if (iseq->arg_rest < 0) {
|
if (BUILTIN_TYPE(iseq) != T_NODE) {
|
||||||
return INT2FIX(iseq->argc);
|
if (iseq->arg_rest < 0) {
|
||||||
|
return INT2FIX(iseq->argc);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return INT2FIX(-(iseq->argc + 1 + iseq->arg_post_len));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return INT2FIX(-(iseq->argc + 1 + iseq->arg_post_len));
|
NODE *node = (NODE *)iseq;
|
||||||
|
if (nd_type(node) == NODE_IFUNC && node->nd_cfnc == bmcall) {
|
||||||
|
/* method(:foo).to_proc.arity */
|
||||||
|
return INT2FIX(method_arity(node->nd_tval));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
return INT2FIX(-1);
|
||||||
return INT2FIX(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user