Fix incomplete switch statement in imemo_memsize

The switch statement is not exhaustive, meaning the "unreachable"
comment was not correct. This commit fixes it by making the list
exhaustive and adding an rb_bug in the default case.
This commit is contained in:
Peter Zhu 2024-02-20 17:18:11 -05:00
parent 01c7e16c0c
commit 402690c3b6

5
gc.c
View File

@ -3060,6 +3060,9 @@ imemo_memsize(VALUE obj)
case imemo_ast: case imemo_ast:
size += rb_ast_memsize(&RANY(obj)->as.imemo.ast); size += rb_ast_memsize(&RANY(obj)->as.imemo.ast);
break; break;
case imemo_callcache:
case imemo_callinfo:
case imemo_constcache:
case imemo_cref: case imemo_cref:
case imemo_svar: case imemo_svar:
case imemo_throw_data: case imemo_throw_data:
@ -3068,7 +3071,7 @@ imemo_memsize(VALUE obj)
case imemo_parser_strterm: case imemo_parser_strterm:
break; break;
default: default:
/* unreachable */ rb_bug("unreachable");
break; break;
} }
return size; return size;