diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-14 16:00:36 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-14 16:00:36 +0000 |
commit | 9d4144af0942821bd6fbb752d734e8e26b91792b (patch) | |
tree | 2450a18ef7b0fee251150117dec0df21b32b5127 /eval.c | |
parent | eeb6612e72a1e2ed96bcbc9c32c3d25d7b3bd0bc (diff) | |
download | ruby-9d4144af0942821bd6fbb752d734e8e26b91792b.tar.gz |
* eval.c (rb_yield_0): lambda{}.call(1) should raise exception.
[ruby-talk:120253]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 |