aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-12 13:57:30 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit9c92dcf366d2f66a085bd23f0b4934415e1a15b2 (patch)
tree2ecf51dd6b19732698f197e7c250fc8d687bec31 /compile.c
parenta8d992ac000d4cc8f8fe691d22c45e5b8db95f2d (diff)
downloadruby-9c92dcf366d2f66a085bd23f0b4934415e1a15b2.tar.gz
ibf_dump_object_object: 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.
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/compile.c b/compile.c
index bb9cdc0873..f641cf91ee 100644
--- a/compile.c
+++ b/compile.c
@@ -11610,12 +11610,9 @@ ibf_dump_object_object(struct ibf_dump *dump, VALUE obj)
IBF_W_ALIGN(ibf_offset_t);
current_offset = ibf_dump_pos(dump);
- if (SPECIAL_CONST_P(obj)) {
- if (RB_TYPE_P(obj, T_SYMBOL) ||
- RB_TYPE_P(obj, T_FLOAT)) {
- obj_header.internal = FALSE;
- goto dump_object;
- }
+ if (SPECIAL_CONST_P(obj) &&
+ ! (RB_TYPE_P(obj, T_SYMBOL) ||
+ RB_TYPE_P(obj, T_FLOAT))) {
obj_header.special_const = TRUE;
obj_header.frozen = TRUE;
obj_header.internal = TRUE;
@@ -11623,8 +11620,7 @@ ibf_dump_object_object(struct ibf_dump *dump, VALUE obj)
ibf_dump_write_small_value(dump, obj);
}
else {
- obj_header.internal = (RBASIC_CLASS(obj) == 0) ? TRUE : FALSE;
- dump_object:
+ obj_header.internal = SPECIAL_CONST_P(obj) ? FALSE : (RBASIC_CLASS(obj) == 0) ? TRUE : FALSE;
obj_header.special_const = FALSE;
obj_header.frozen = FL_TEST(obj, FL_FREEZE) ? TRUE : FALSE;
ibf_dump_object_object_header(dump, obj_header);