aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index 8bef0bcdd4..2f58a216dd 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