summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-01 20:16:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-01 20:16:53 +0000
commitcdacb127fc82920afed967222716d6775273432a (patch)
treee03d777bdac7dd2a882e7848a8b2f7c3b73f09ee /eval.c
parentbaf02b9a6330acff09c80f27cfc2e7b8536f5f68 (diff)
* class.c (rb_obj_singleton_methods): should not go up to
ancestors unless the recursive flag is set. [ruby-list:38007] * hash.c (env_each_key): use env_keys to avoid environment modify on the fly. * hash.c (env_each_value): use env_values for safety. * hash.c (env_each): allocate environment array first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index fd28c166fc..44d4dd0d16 100644
--- a/eval.c
+++ b/eval.c
@@ -4099,16 +4099,20 @@ rb_yield_0(val, self, klass, flags, avalue)
int len = 0;
if (avalue) {
len = RARRAY(val)->len;
+ if (len == 0) {
+ val = Qnil;
+ goto multi_values;
+ }
if (len == 1) {
val = RARRAY(val)->ptr[0];
}
else {
- goto mult_values;
+ goto multi_values;
}
}
else if (val == Qundef) {
val = Qnil;
- mult_values:
+ multi_values:
{
NODE *curr = ruby_current_node;
ruby_current_node = block->var;