From 95fb7684557a8da8e36d552b1bda6042f648d5e2 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index d03f031b9..f099654d1 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