From 1f6e74106f452057d857e7f935b13b2064cfac98 Mon Sep 17 00:00:00 2001 From: 卜部昌平 Date: Tue, 16 Jun 2020 10:49:02 +0900 Subject: 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. --- object.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'object.c') diff --git a/object.c b/object.c index 03cc51a473..0c59985877 100644 --- a/object.c +++ b/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; -- cgit v1.2.3