diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-16 10:49:02 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | 1f6e74106f452057d857e7f935b13b2064cfac98 (patch) | |
tree | abb2046282902de65373b725471b759410713db4 /object.c | |
parent | 03354feb6a01b048039cc586dd7135ee71446821 (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.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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; |