mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
6d779ac139
commit
ea2e8d3592
2 changed files with 14 additions and 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
|
||||
|
|
13
eval.c
13
eval.c
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue