diff options
Diffstat (limited to 'shape.c')
-rw-r--r-- | shape.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -238,7 +238,9 @@ remove_shape_recursive(VALUE obj, ID id, rb_shape_t * shape, VALUE * removed) // has the same attributes as this shape. if (new_parent) { bool dont_care; - rb_shape_t * new_child = get_next_shape_internal(new_parent, shape->edge_name, shape->type, &dont_care, true, false); + enum ruby_value_type type = BUILTIN_TYPE(obj); + bool new_shape_necessary = type == T_CLASS || type == T_MODULE; + rb_shape_t * new_child = get_next_shape_internal(new_parent, shape->edge_name, shape->type, &dont_care, true, new_shape_necessary); new_child->capacity = shape->capacity; if (new_child->type == SHAPE_IVAR) { move_iv(obj, id, shape->next_iv_index - 1, new_child->next_iv_index - 1); |