* eval.c (rb_eval): iterator should return value from next inside

begin/rescue/end.  (ruby-bugs:PR#1218)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-11-16 09:11:01 +00:00
parent 1fc7d20da2
commit 4e2fd6be8d
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Sun Nov 16 18:10:57 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_eval): iterator should return value from next inside
begin/rescue/end. (ruby-bugs:PR#1218)
Sun Nov 16 13:26:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Sun Nov 16 13:26:07 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (eval): prepend error position in evaluating string to * eval.c (eval): prepend error position in evaluating string to

9
eval.c
View File

@ -2862,6 +2862,7 @@ rb_eval(self, n)
} }
else if (state != TAG_RAISE) { else if (state != TAG_RAISE) {
ruby_errinfo = e_info; ruby_errinfo = e_info;
result = prot_tag->retval;
} }
} }
else if (state == TAG_RAISE) { else if (state == TAG_RAISE) {
@ -2880,8 +2881,14 @@ rb_eval(self, n)
resq = resq->nd_head; /* next rescue */ resq = resq->nd_head; /* next rescue */
} }
} }
else {
result = prot_tag->retval;
}
POP_TAG(); POP_TAG();
if (state) JUMP_TAG(state); if (state) {
if (state == TAG_NEXT) prot_tag->retval = result;
JUMP_TAG(state);
}
/* no exception raised */ /* no exception raised */
if (!rescuing && (node = node->nd_else)) { /* else clause given */ if (!rescuing && (node = node->nd_else)) { /* else clause given */
goto again; goto again;