diff options
author | Peter Zhu <[email protected]> | 2023-11-01 11:37:13 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-11-01 11:37:13 -0400 |
commit | e6059d0c84b2347ce542f7fb655021f73f744447 () | |
tree | 6bc249c9fcba52b24432fe689c7e6bb709457f96 /variable.c | |
parent | 70e3e08881d3f7f59828776de6af8b1898ebfe77 (diff) |
Refactor rb_obj_remove_instance_variable
-rw-r--r-- | variable.c | 57 |
1 files changed, 25 insertions, 32 deletions
@@ -2194,47 +2194,40 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name) rb_shape_t * shape = rb_shape_get_shape(obj); - switch (BUILTIN_TYPE(obj)) { - case T_CLASS: - case T_MODULE: IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(id); - if (!rb_shape_transition_shape_remove_ivar(obj, id, shape, &val)) { - if (!rb_shape_obj_too_complex(obj)) { - rb_evict_ivars_to_hash(obj, shape); - } - if (!st_delete(RCLASS_IV_HASH(obj), (st_data_t *)&id, (st_data_t *)&val)) { - val = Qundef; - } } - break; - case T_OBJECT: { - if (!rb_shape_transition_shape_remove_ivar(obj, id, shape, &val)) { - if (!rb_shape_obj_too_complex(obj)) { - rb_evict_ivars_to_hash(obj, shape); - } - if (!st_delete(ROBJECT_IV_HASH(obj), (st_data_t *)&id, (st_data_t *)&val)) { - val = Qundef; - } - } - break; - } - default: { - if (!rb_shape_transition_shape_remove_ivar(obj, id, shape, &val)) { - if (!rb_shape_obj_too_complex(obj)) { - rb_evict_ivars_to_hash(obj, shape); - } struct gen_ivtbl *ivtbl; if (rb_gen_ivtbl_get(obj, 0, &ivtbl)) { - if (!st_delete(ivtbl->as.complex.table, (st_data_t *)&id, (st_data_t *)&val)) { - val = Qundef; - } } } - break; - } } if (val != Qundef) { |