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.
This commit is contained in:
parent
a8d992ac00
commit
9c92dcf366
Notes:
git
2020-06-29 11:07:10 +09:00
12
compile.c
12
compile.c
@ -11610,12 +11610,9 @@ ibf_dump_object_object(struct ibf_dump *dump, VALUE obj)
|
|||||||
IBF_W_ALIGN(ibf_offset_t);
|
IBF_W_ALIGN(ibf_offset_t);
|
||||||
current_offset = ibf_dump_pos(dump);
|
current_offset = ibf_dump_pos(dump);
|
||||||
|
|
||||||
if (SPECIAL_CONST_P(obj)) {
|
if (SPECIAL_CONST_P(obj) &&
|
||||||
if (RB_TYPE_P(obj, T_SYMBOL) ||
|
! (RB_TYPE_P(obj, T_SYMBOL) ||
|
||||||
RB_TYPE_P(obj, T_FLOAT)) {
|
RB_TYPE_P(obj, T_FLOAT))) {
|
||||||
obj_header.internal = FALSE;
|
|
||||||
goto dump_object;
|
|
||||||
}
|
|
||||||
obj_header.special_const = TRUE;
|
obj_header.special_const = TRUE;
|
||||||
obj_header.frozen = TRUE;
|
obj_header.frozen = TRUE;
|
||||||
obj_header.internal = 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);
|
ibf_dump_write_small_value(dump, obj);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
obj_header.internal = (RBASIC_CLASS(obj) == 0) ? TRUE : FALSE;
|
obj_header.internal = SPECIAL_CONST_P(obj) ? FALSE : (RBASIC_CLASS(obj) == 0) ? TRUE : FALSE;
|
||||||
dump_object:
|
|
||||||
obj_header.special_const = FALSE;
|
obj_header.special_const = FALSE;
|
||||||
obj_header.frozen = FL_TEST(obj, FL_FREEZE) ? TRUE : FALSE;
|
obj_header.frozen = FL_TEST(obj, FL_FREEZE) ? TRUE : FALSE;
|
||||||
ibf_dump_object_object_header(dump, obj_header);
|
ibf_dump_object_object_header(dump, obj_header);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user