diff options
author | 卜部昌平 <[email protected]> | 2020-06-16 12:24:30 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-06-29 11:05:41 +0900 |
commit | 2bfac015d3742408d0c4d9f2220413992d0e49c6 (patch) | |
tree | ad73fd3d2c771c3b108cc6bc11d03fd9177fddbb /proc.c | |
parent | 3db159193ed86b6db409e00ac73adab143283b4e (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
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -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); |