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 | 7fc3c14b2ce9f85490113d819b75e6126a48500b (patch) | |
tree | 2450a18ef7b0fee251150117dec0df21b32b5127 /eval.c | |
parent | aefdc4a63fbaf3205f3ef5225ec4d8c089708a38 (diff) | |
download | ruby-7fc3c14b2ce9f85490113d819b75e6126a48500b.tar.gz ruby-7fc3c14b2ce9f85490113d819b75e6126a48500b.tar.xz ruby-7fc3c14b2ce9f85490113d819b75e6126a48500b.zip |
* 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
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 |