* eval.c (next_jump): deal with destination of next.

fixed: [ruby-core:08169]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2006-07-08 15:55:37 +00:00
Родитель e6948e5334
Коммит b922355c0d
2 изменённых файлов: 34 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sun Jul 9 00:54:11 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (next_jump): deal with destination of next.
fixed: [ruby-core:08169]
Fri Jul 7 17:49:16 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (rb_str_ord): extract lower byte. fixed: [ruby-dev:28980]

32
eval.c
Просмотреть файл

@ -2660,6 +2660,7 @@ class_prefix(VALUE self, NODE *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 VALUE call_super(int, const VALUE*, struct BLOCK*);
@ -2978,8 +2979,7 @@ rb_eval(VALUE self, NODE *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:
@ -3056,7 +3056,6 @@ rb_eval(VALUE self, NODE *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 */
@ -4656,6 +4655,33 @@ break_jump(VALUE retval)
localjump_error("unexpected break", retval, TAG_BREAK, 0);
}
static void
next_jump(VALUE retval)
{
struct tag *tt = prot_tag;
if (retval == Qundef) retval = Qnil;
while (tt) {
switch (tt->tag) {
case PROT_THREAD:
/* skip toplevel tag */
if (!tt->prev) break;
case PROT_YIELD:
case PROT_LAMBDA:
case PROT_LOOP:
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, 0);
}
static VALUE bmcall(VALUE, VALUE);
static int method_arity(VALUE);