aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-15 12:01:50 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit13bdbfcecbe7652c4c8315d1c615e205b83123e8 (patch)
tree3804d14099dbebe7115be4bdf01f1f5c197d768b /eval.c
parent0b1b73451528d946060f4876aa38fc3278899deb (diff)
downloadruby-13bdbfcecbe7652c4c8315d1c615e205b83123e8.tar.gz
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.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index 65414d27cc..ac442dd774 100644
--- a/eval.c
+++ b/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)) {
- fatal:
- ec->errinfo = exception_error;
- rb_ec_reset_raised(ec);
- EC_JUMP_TAG(ec, TAG_FATAL);
+ goto fatal;
}
if (tag != TAG_FATAL) {
RUBY_DTRACE_HOOK(RAISE, rb_obj_classname(ec->errinfo));
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 */