summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-16 12:24:30 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit2bfac015d3742408d0c4d9f2220413992d0e49c6 (patch)
treead73fd3d2c771c3b108cc6bc11d03fd9177fddbb
parent3db159193ed86b6db409e00ac73adab143283b4e (diff)
proc_binding: 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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3247
-rw-r--r--proc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/proc.c b/proc.c
index ee4ca9a368..27806306ab 100644
--- a/proc.c
+++ b/proc.c
@@ -3229,8 +3229,6 @@ proc_binding(VALUE self)
GetProcPtr(block->as.proc, proc);
block = &proc->block;
goto again;
- case block_type_symbol:
- goto error;
case block_type_ifunc:
{
const struct vm_ifunc *ifunc = block->as.captured.code.ifunc;
@@ -3247,12 +3245,11 @@ proc_binding(VALUE self)
RB_OBJ_WRITE(env, &env->iseq, empty);
break;
}
- else {
- error:
- rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
- return Qnil;
- }
}
+ /* FALLTHROUGH */
+ case block_type_symbol:
+ rb_raise(rb_eArgError, "Can't create Binding from C level Proc");
+ UNREACHABLE_RETURN(Qnil);
}
bindval = rb_binding_alloc(rb_cBinding);