summaryrefslogtreecommitdiffstats
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
commit55c60fa4a1c9f6476795670aab0ba595a640f377 (patch)
treee03d777bdac7dd2a882e7848a8b2f7c3b73f09ee /eval.c
parent8d826f9e27d8899c51393c37a0af31b52edad351 (diff)
downloadruby-55c60fa4a1c9f6476795670aab0ba595a640f377.tar.gz
ruby-55c60fa4a1c9f6476795670aab0ba595a640f377.tar.xz
ruby-55c60fa4a1c9f6476795670aab0ba595a640f377.zip
* 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: http://svn.ruby-lang.org/repos/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 fd28c166f..44d4dd0d1 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;