diff options
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 32 |
1 files changed, 14 insertions, 18 deletions
@@ -741,7 +741,7 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, int state; rb_thread_t *th = GET_THREAD(); rb_control_frame_t *cfp = th->cfp; - volatile VALUE result; + volatile VALUE result = Qfalse; volatile VALUE e_info = th->errinfo; va_list args; @@ -750,6 +750,15 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, retry_entry: result = (*b_proc) (data1); } + else if (result) { + /* escape from r_proc */ + if (state == TAG_RETRY) { + state = 0; + th->errinfo = Qnil; + result = Qfalse; + goto retry_entry; + } + } else { th->cfp = cfp; /* restore */ @@ -767,25 +776,12 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, va_end(args); if (handle) { + result = Qnil; + state = 0; if (r_proc) { - PUSH_TAG(); - if ((state = EXEC_TAG()) == 0) { - result = (*r_proc) (data2, th->errinfo); - } - POP_TAG(); - if (state == TAG_RETRY) { - state = 0; - th->errinfo = Qnil; - goto retry_entry; - } - } - else { - result = Qnil; - state = 0; - } - if (state == 0) { - th->errinfo = e_info; + result = (*r_proc) (data2, th->errinfo); } + th->errinfo = e_info; } } } |