* eval.c (rb_yield_0): should check args_args before lambda

argument check.  [ruby-dev:29029]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-07-19 13:52:03 +00:00
Родитель f724560996
Коммит cb3e51e712
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Wed Jul 19 19:40:00 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_yield_0): should check args_args before lambda
argument check. [ruby-dev:29029]
Tue Jul 18 23:53:59 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* process.c (rb_f_system): shouldn't block SIGCHLD if it's not

5
eval.c
Просмотреть файл

@ -4710,7 +4710,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags)
int old_vmode;
struct FRAME frame;
NODE *cnode = ruby_current_node;
int ary_args = flags & YIELD_ARY_ARGS, lambda;
int ary_args, lambda;
int state, broken = 0;
rb_need_block();
@ -4744,6 +4744,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags)
node = block->body;
var = block->var;
lambda = block->flags & BLOCK_LAMBDA;
ary_args = flags & YIELD_ARY_ARGS;
if (var) {
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
@ -4819,7 +4820,7 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags)
POP_TAG();
if (state) goto pop_state;
}
else if (lambda && RARRAY(val)->len != 0 &&
else if (lambda && ary_args && RARRAY(val)->len != 0 &&
(!node || nd_type(node) != NODE_IFUNC ||
node->nd_cfnc != bmcall)) {
rb_raise(rb_eArgError, "wrong number of arguments (%ld for 0)",