diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-17 14:45:25 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-17 14:45:25 +0000 |
commit | ea2e8d3592aa35148da0c28f99d6a74855c5b585 (patch) | |
tree | bacca44ca6b1c009dd69726360f08910cab4d099 | |
parent | 6d779ac139129329bdee76afb7500d76163badc4 (diff) | |
download | ruby-ea2e8d3592aa35148da0c28f99d6a74855c5b585.tar.gz |
* eval.c (localjump_destination): should not raise ThreadError
exception for "break". [ruby-dev:21348]
* eval.c (proc_invoke): use result instead of prot_tag->retval.
retval is no longer propagated to the ancestors.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | eval.c | 13 |
2 files changed, 14 insertions, 7 deletions
@@ -1,3 +1,11 @@ +Wed Sep 17 23:41:45 2003 Yukihiro Matsumoto <matz@ruby-lang.org> + + * eval.c (localjump_destination): should not raise ThreadError + exception for "break". [ruby-dev:21348] + + * eval.c (proc_invoke): use result instead of prot_tag->retval. + retval is no longer propagated to the ancestors. + Wed Sep 17 20:34:00 2003 Nobuyoshi Nakada <nobu@ruby-lang.org> * parse.y (tokadd_string, parse_string, yylex): escaped terminator @@ -1487,15 +1487,15 @@ rb_eval_string_wrap(str, state) } static void -localjump_error(mesg, status, reason) +localjump_error(mesg, value, reason) const char *mesg; - VALUE status; + VALUE value; int reason; { VALUE exc = rb_exc_new2(rb_eLocalJumpError, mesg); VALUE id; - rb_iv_set(exc, "@exit_value", status); + rb_iv_set(exc, "@exit_value", value); switch (reason) { case TAG_BREAK: id = rb_intern("break"); break; @@ -4028,7 +4028,7 @@ localjump_destination(state, scope, retval) if (retval == Qundef) retval = Qnil; while (tt) { - if (tt->tag == PROT_PCALL || + if (tt->tag == PROT_PCALL || (tt->tag == PROT_THREAD && state == TAG_BREAK) || (tt->tag == PROT_CALL || tt->tag == tag) && tt->scope == scope) { tt->dst = (VALUE)scope; tt->retval = retval; @@ -4036,8 +4036,7 @@ localjump_destination(state, scope, retval) } if (tt->tag == PROT_FUNC && tt->scope == scope) break; if (tt->tag == PROT_THREAD) { - rb_raise(rb_eThreadError, "%s jump can't across threads", - (state == TAG_BREAK) ? "break" : "return"); + rb_raise(rb_eThreadError, "return jump can't across threads"); } tt = tt->prev; } @@ -7061,7 +7060,7 @@ proc_invoke(proc, args, self, klass) char mesg[32]; snprintf(mesg, sizeof mesg, "%s from proc-closure", state == TAG_BREAK ? "break" : "return"); - localjump_error(mesg, prot_tag->retval, state); + localjump_error(mesg, result, state); } if (result != Qundef) { localjump_destination(state, ruby_scope, result); |