Fix remove_instance_variable for too complex generic ivar
This commit is contained in:
parent
60e207b47f
commit
c3b7f27561
@ -287,6 +287,9 @@ class TestShapes < Test::Unit::TestCase
|
|||||||
tc = TooComplex.new
|
tc = TooComplex.new
|
||||||
tc.instance_variable_set(:@a, 1)
|
tc.instance_variable_set(:@a, 1)
|
||||||
tc.instance_variable_set(:@b, 2)
|
tc.instance_variable_set(:@b, 2)
|
||||||
|
|
||||||
|
tc.remove_instance_variable(:@a)
|
||||||
|
assert_nil(tc.instance_variable_get(:@a))
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
10
variable.c
10
variable.c
@ -2217,7 +2217,15 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
rb_shape_transition_shape_remove_ivar(obj, id, shape, &val);
|
if (rb_shape_obj_too_complex(obj)) {
|
||||||
|
struct gen_ivtbl *ivtbl;
|
||||||
|
if (rb_gen_ivtbl_get(obj, 0, &ivtbl)) {
|
||||||
|
st_delete(ivtbl->as.complex.table, (st_data_t *)&id, (st_data_t *)&val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rb_shape_transition_shape_remove_ivar(obj, id, shape, &val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user