summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-24 10:48:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-24 10:48:43 +0000
commit901343a761e7868839e00c69ac142353db734d0e (patch)
tree1d17d2ca125db42acd397b48acdf4be763caf434 /eval.c
parent4e183b11acebdbce9fe843059ddb8e18e491cce1 (diff)
* enumerator.c (enumerator_next): stop pre-fetching.
* enumerator.c (Init_Enumerator): remove next? method. * eval.c (rb_f_loop): now handles StopIteration exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 3780c19aa8..721ac6302c 100644
--- a/eval.c
+++ b/eval.c
@@ -951,6 +951,14 @@ rb_yield_splat(VALUE values)
return v;
}
+static VALUE
+loop_i()
+{
+ for (;;) {
+ rb_yield_0(0, 0);
+ }
+}
+
/*
* call-seq:
* loop {|| block }
@@ -968,9 +976,7 @@ rb_yield_splat(VALUE values)
static VALUE
rb_f_loop(void)
{
- for (;;) {
- rb_yield_0(0, 0);
- }
+ rb_rescue2(loop_i, (VALUE)0, 0, 0, rb_eStopIteration, (VALUE)0);
return Qnil; /* dummy */
}