class_or_module_required: 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
03354feb6a
commit
1f6e74106f
Notes:
git
2020-06-29 11:06:58 +09:00
4
object.c
4
object.c
@ -827,15 +827,13 @@ rb_obj_inspect(VALUE obj)
|
||||
static VALUE
|
||||
class_or_module_required(VALUE c)
|
||||
{
|
||||
if (SPECIAL_CONST_P(c)) goto not_class;
|
||||
switch (BUILTIN_TYPE(c)) {
|
||||
switch (OBJ_BUILTIN_TYPE(c)) {
|
||||
case T_MODULE:
|
||||
case T_CLASS:
|
||||
case T_ICLASS:
|
||||
break;
|
||||
|
||||
default:
|
||||
not_class:
|
||||
rb_raise(rb_eTypeError, "class or module required");
|
||||
}
|
||||
return c;
|
||||
|
Loading…
x
Reference in New Issue
Block a user