mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
3db159193e
commit
2bfac015d3
Notes:
git
2020-06-29 11:06:54 +09:00
1 changed files with 4 additions and 7 deletions
11
proc.c
11
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue