setup_exception: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
This commit is contained in:
parent
0b1b734515
commit
13bdbfcecb
Notes:
git
2020-06-29 11:07:06 +09:00
11
eval.c
11
eval.c
@ -641,16 +641,19 @@ setup_exception(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rb_ec_set_raised(ec)) {
|
if (rb_ec_set_raised(ec)) {
|
||||||
fatal:
|
goto fatal;
|
||||||
ec->errinfo = exception_error;
|
|
||||||
rb_ec_reset_raised(ec);
|
|
||||||
EC_JUMP_TAG(ec, TAG_FATAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag != TAG_FATAL) {
|
if (tag != TAG_FATAL) {
|
||||||
RUBY_DTRACE_HOOK(RAISE, rb_obj_classname(ec->errinfo));
|
RUBY_DTRACE_HOOK(RAISE, rb_obj_classname(ec->errinfo));
|
||||||
EXEC_EVENT_HOOK(ec, RUBY_EVENT_RAISE, ec->cfp->self, 0, 0, 0, mesg);
|
EXEC_EVENT_HOOK(ec, RUBY_EVENT_RAISE, ec->cfp->self, 0, 0, 0, mesg);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
fatal:
|
||||||
|
ec->errinfo = exception_error;
|
||||||
|
rb_ec_reset_raised(ec);
|
||||||
|
EC_JUMP_TAG(ec, TAG_FATAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \private */
|
/*! \private */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user