summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-16 10:49:02 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit1f6e74106f452057d857e7f935b13b2064cfac98 (patch)
treeabb2046282902de65373b725471b759410713db4 /object.c
parent03354feb6a01b048039cc586dd7135ee71446821 (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3247
Diffstat (limited to 'object.c')
-rw-r--r--object.c4
1 files changed, 1 insertions, 3 deletions
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;