diff options
author | Jean Boussier <[email protected]> | 2025-03-13 13:29:37 +0100 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-03-14 09:51:57 +0100 |
commit | de48e47ddf78aba02fd9623bc7ce685540a10743 (patch) | |
tree | e4e7d409eb5d8343b85dc2628f5e1c8e7782b2dc /class.c | |
parent | dd7deef338d843c8d866ddc279854068b39bfeb9 (diff) |
Invoke `inherited` callbacks before `const_added`
[Misc #21143]
Conceptually this makes sense and is more consistent with using
the `Name = Class.new(Superclass)` alternative method.
However the new class is still named before `inherited` is called.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12927
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1004,8 +1004,8 @@ rb_define_class(const char *name, VALUE super) } klass = rb_define_class_id(id, super); rb_vm_register_global_object(klass); - rb_const_set(rb_cObject, id, klass); rb_class_inherited(super, klass); + rb_const_set(rb_cObject, id, klass); return klass; } @@ -1043,8 +1043,8 @@ rb_define_class_id_under_no_pin(VALUE outer, ID id, VALUE super) } klass = rb_define_class_id(id, super); rb_set_class_path_string(klass, outer, rb_id2str(id)); - rb_const_set(outer, id, klass); rb_class_inherited(super, klass); + rb_const_set(outer, id, klass); return klass; } |