summaryrefslogtreecommitdiffstats
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
commite53e529e42a3f1593ae85676aa69ae2c43cf2260 (patch)
tree90b1f9bfc173af0ea61605e69ad049a2f4212f0b /eval.c
parentfeab839cb3f04b5fe577d5ba76a06bb7a73aa4c4 (diff)
downloadruby-e53e529e42a3f1593ae85676aa69ae2c43cf2260.tar.gz
ruby-e53e529e42a3f1593ae85676aa69ae2c43cf2260.tar.xz
ruby-e53e529e42a3f1593ae85676aa69ae2c43cf2260.zip
* 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
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 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