summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-05 22:32:04 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-05 22:32:04 +0000
commit2d096851501ba172ab1d50c97a65a8f066d5a519 (patch)
tree90b1f9bfc173af0ea61605e69ad049a2f4212f0b /eval.c
parent8d6db94ec7d4acc5944d64fe67089029fdc968df (diff)
downloadruby-2d096851501ba172ab1d50c97a65a8f066d5a519.tar.gz
* eval.c (rb_yield_0): small refactoring.
* parse.y (bparam_item): fixed bugs in handling parenthesized LHS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/eval.c b/eval.c
index 78448a6384..9e788df9e1 100644
--- a/eval.c
+++ b/eval.c
@@ -4780,16 +4780,14 @@ rb_yield_0(VALUE val, VALUE self, VALUE klass /* OK */, int flags)
massign(self, var, val, lambda);
}
else {
- if (lambda) {
- if (val == Qundef) {
- rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
- }
- if (TYPE(val) == T_ARRAY && RARRAY_LEN(val) != 1) {
+ if (lambda && val == Qundef) {
+ rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
+ }
+ if (ary_args) {
+ if (lambda && RARRAY_LEN(val) != 1) {
rb_raise(rb_eArgError, "wrong number of arguments (%ld for 1)",
RARRAY_LEN(val));
}
- }
- if (ary_args) {
if (RARRAY_LEN(val) == 0)
val = Qnil;
else