diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | eval.c | 31 |
2 files changed, 33 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Sun Jul 9 00:54:34 2006 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * eval.c (next_jump): deal with destination of next. + fixed: [ruby-core:08169] + Fri Jul 7 00:38:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org> * hash.c (rb_hash_default): should not call default procedure if @@ -2862,6 +2862,7 @@ class_prefix(self, cpath) NORETURN(static void return_jump _((VALUE))); NORETURN(static void break_jump _((VALUE))); +NORETURN(static void next_jump _((VALUE))); NORETURN(static void unknown_node _((NODE * volatile))); static void @@ -3200,8 +3201,7 @@ rb_eval(self, n) case NODE_NEXT: CHECK_INTS; - return_value(rb_eval(self, node->nd_stts)); - JUMP_TAG(TAG_NEXT); + next_jump(rb_eval(self, node->nd_stts)); break; case NODE_REDO: @@ -3283,7 +3283,6 @@ rb_eval(self, n) POP_TAG(); if (state != TAG_RAISE) ruby_errinfo = e_info; if (state) { - if (state == TAG_NEXT) prot_tag->retval = result; JUMP_TAG(state); } /* no exception raised */ @@ -4816,6 +4815,32 @@ break_jump(retval) localjump_error("unexpected break", retval, TAG_BREAK); } +static void +next_jump(retval) + VALUE retval; +{ + struct tag *tt = prot_tag; + + if (retval == Qundef) retval = Qnil; + while (tt) { + switch (tt->tag) { + case PROT_THREAD: + case PROT_YIELD: + case PROT_LOOP: + case PROT_LAMBDA: + case PROT_FUNC: + tt->dst = (VALUE)tt->frame->uniq; + tt->retval = retval; + JUMP_TAG(TAG_NEXT); + break; + default: + break; + } + tt = tt->prev; + } + localjump_error("unexpected next", retval, TAG_NEXT); +} + void rb_need_block() { |