From 46c525ca9bcf851c26f9cd06a32f4098bad65acf Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 8 Jul 2006 15:55:37 +0000 Subject: * eval.c (next_jump): deal with destination of next. fixed: [ruby-core:08169] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9e8e44d17..1b7aa9e135 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 9 00:54:34 2006 Nobuyoshi Nakada + + * eval.c (next_jump): deal with destination of next. + fixed: [ruby-core:08169] + Fri Jul 7 00:38:49 2006 Yukihiro Matsumoto * hash.c (rb_hash_default): should not call default procedure if diff --git a/eval.c b/eval.c index d03f031b9e..f099654d1c 100644 --- a/eval.c +++ b/eval.c @@ -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() { -- cgit v1.2.3