mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Rename RB_OBJ_SHAPE
-> rb_obj_shape
As well as `RB_OBJ_SHAPE_ID` -> `rb_obj_shape_id` and `RSHAPE` is now a simple alias for `rb_shape_lookup`. I tried to turn all these into `static inline` but I'm having trouble with `RUBY_EXTERN rb_shape_tree_t *rb_shape_tree_ptr;` not being exposed as I'd expect.
This commit is contained in:
parent
0b81359b3f
commit
ea77250847
Notes:
git
2025-05-09 08:23:05 +00:00
14 changed files with 68 additions and 67 deletions
|
@ -713,18 +713,18 @@ has_ivars(VALUE obj, VALUE encname, VALUE *ivobj)
|
|||
static void
|
||||
w_ivar_each(VALUE obj, st_index_t num, struct dump_call_arg *arg)
|
||||
{
|
||||
shape_id_t shape_id = RB_OBJ_SHAPE_ID(arg->obj);
|
||||
shape_id_t shape_id = rb_obj_shape_id(arg->obj);
|
||||
struct w_ivar_arg ivarg = {arg, num};
|
||||
if (!num) return;
|
||||
rb_ivar_foreach(obj, w_obj_each, (st_data_t)&ivarg);
|
||||
|
||||
shape_id_t actual_shape_id = RB_OBJ_SHAPE_ID(arg->obj);
|
||||
shape_id_t actual_shape_id = rb_obj_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(shape_id) > rb_shape_depth(RB_OBJ_SHAPE_ID(arg->obj))) {
|
||||
if (rb_shape_depth(shape_id) > rb_shape_depth(rb_obj_shape_id(arg->obj))) {
|
||||
rb_raise(rb_eRuntimeError, "instance variable removed from %"PRIsVALUE" instance",
|
||||
CLASS_OF(arg->obj));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue