get_pat_quoted: 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:
卜部昌平 2020-06-18 15:24:56 +09:00
parent 673ddea934
commit fdae2063fb
Notes: git 2020-06-29 11:06:46 +09:00

View File

@ -5032,8 +5032,7 @@ get_pat_quoted(VALUE pat, int check)
{
VALUE val;
if (SPECIAL_CONST_P(pat)) goto to_string;
switch (BUILTIN_TYPE(pat)) {
switch (OBJ_BUILTIN_TYPE(pat)) {
case T_REGEXP:
return pat;
@ -5041,7 +5040,6 @@ get_pat_quoted(VALUE pat, int check)
break;
default:
to_string:
val = rb_check_string_type(pat);
if (NIL_P(val)) {
Check_Type(pat, T_REGEXP);