From e53e529e42a3f1593ae85676aa69ae2c43cf2260 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 5 Oct 2006 22:32:04 +0000 Subject: * eval.c (rb_yield_0): small refactoring. * parse.y (bparam_item): fixed bugs in handling parenthesized LHS. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 78448a638..9e788df9e 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 -- cgit