From 7fc3c14b2ce9f85490113d819b75e6126a48500b Mon Sep 17 00:00:00 2001 From: matz Date: Sun, 14 Nov 2004 16:00:36 +0000 Subject: * eval.c (rb_yield_0): lambda{}.call(1) should raise exception. [ruby-talk:120253] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 8bef0bcdd..2f58a216d 100644 --- a/eval.c +++ b/eval.c @@ -4569,6 +4569,9 @@ break_jump(retval) localjump_error("unexpected break", retval, TAG_BREAK); } +static VALUE bmcall _((VALUE, VALUE)); +static VALUE method_arity _((VALUE)); + static VALUE rb_yield_0(val, self, klass, flags, avalue) VALUE val, self, klass; /* OK */ @@ -4686,7 +4689,9 @@ rb_yield_0(val, self, klass, flags, avalue) POP_TAG(); if (state) goto pop_state; } - else if (lambda && RARRAY(val)->len != 0) { + else if (lambda && 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)", RARRAY(val)->len); } @@ -8217,9 +8222,6 @@ proc_call(proc, args) return proc_invoke(proc, args, Qundef, 0); } -static VALUE bmcall _((VALUE, VALUE)); -static VALUE method_arity _((VALUE)); - /* * call-seq: * prc.arity -> fixnum -- cgit