Skip to content

Commit c0858f4

Browse files
committed
shape.c: Add a hack to fix variation accounting of T_CLASS and T_MODULE.
This would be fixed by using proper T_IMEMO instead of T_OBJECT to store class fields.
1 parent f27df2d commit c0858f4

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

shape.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -770,14 +770,11 @@ shape_get_next(rb_shape_t *shape, VALUE obj, ID id, bool emit_warnings)
770770
#endif
771771

772772
VALUE klass;
773-
switch (BUILTIN_TYPE(obj)) {
774-
case T_CLASS:
775-
case T_MODULE:
776-
klass = rb_singleton_class(obj);
777-
break;
778-
default:
773+
if (RB_TYPE_P(obj, T_OBJECT) && FL_TEST_RAW(obj, ROBJECT_HIDDEN)) { // HACK
774+
klass = CLASS_OF(obj);
775+
}
776+
else {
779777
klass = rb_obj_class(obj);
780-
break;
781778
}
782779

783780
bool allow_new_shape = RCLASS_VARIATION_COUNT(klass) < SHAPE_MAX_VARIATIONS;

0 commit comments

Comments
 (0)