aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-12 12:48:28 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commitcf29de7e6e92497c31ef08b567fcfe1b72bfaff7 (patch)
tree987f439c8d0949eb8722e1a85b3d4def7c25a3a5 /compile.c
parentcc1e9b8e1178cf4284fbcae1a94950e580491a05 (diff)
downloadruby-cf29de7e6e92497c31ef08b567fcfe1b72bfaff7.tar.gz
compile_next: 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 'compile.c')
-rw-r--r--compile.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/compile.c b/compile.c
index 5bf72e1ec0..a17323e8f8 100644
--- a/compile.c
+++ b/compile.c
@@ -6651,11 +6651,6 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
ADD_INSN(ret, line, putnil);
}
}
- else if (iseq->body->type == ISEQ_TYPE_EVAL) {
- next_in_eval:
- COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with next");
- return COMPILE_NG;
- }
else {
const rb_iseq_t *ip = iseq;
@@ -6674,7 +6669,8 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
break;
}
else if (ip->body->type == ISEQ_TYPE_EVAL) {
- goto next_in_eval;
+ COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with next");
+ return COMPILE_NG;
}
ip = ip->body->parent_iseq;