mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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.
This commit is contained in:
parent
dd7deef338
commit
de48e47ddf
Notes:
git
2025-03-14 08:52:23 +00:00
7 changed files with 72 additions and 21 deletions
4
class.c
4
class.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue