diff options
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -718,15 +718,13 @@ w_ivar_each(VALUE obj, st_index_t num, struct dump_call_arg *arg) if (!num) return; rb_ivar_foreach(obj, w_obj_each, (st_data_t)&ivarg); - if (shape_id != rb_shape_get_shape_id(arg->obj)) { - rb_shape_t * expected_shape = rb_shape_get_shape_by_id(shape_id); - rb_shape_t * actual_shape = rb_shape_get_shape(arg->obj); - + shape_id_t actual_shape_id = rb_shape_get_shape_id(arg->obj); + if (shape_id != actual_shape_id) { // If the shape tree got _shorter_ then we probably removed an IV // If the shape tree got longer, then we probably added an IV. // The exception message might not be accurate when someone adds and // removes the same number of IVs, but they will still get an exception - if (rb_shape_depth(expected_shape) > rb_shape_depth(actual_shape)) { + if (rb_shape_depth(shape_id) > rb_shape_depth(rb_shape_get_shape_id(arg->obj))) { rb_raise(rb_eRuntimeError, "instance variable removed from %"PRIsVALUE" instance", CLASS_OF(arg->obj)); } |