diff options
author | Jean Boussier <[email protected]> | 2023-02-15 10:42:52 +0100 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2023-02-15 15:24:22 +0100 |
commit | 7413079dae81e46aefc948cd8872497567945791 () | |
tree | 31c1118b1bd5d751940571505ff5db1058d612e4 /vm_backtrace.c | |
parent | bac4d2eefa079168968841079727fe2289b6ab6e (diff) |
Encapsulate RCLASS_ATTACHED_OBJECT
Right now the attached object is stored as an instance variable and all the call sites that either get or set it have to know how it's stored. It's preferable to hide this implementation detail behind accessors so that it is easier to change how it's stored.
Notes: Merged: https://.com/ruby/ruby/pull/7308
-rw-r--r-- | vm_backtrace.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -11,6 +11,7 @@ #include "eval_intern.h" #include "internal.h" #include "internal/error.h" #include "internal/vm.h" #include "iseq.h" @@ -1746,7 +1747,7 @@ rb_profile_frame_classpath(VALUE frame) klass = RBASIC(klass)->klass; } else if (FL_TEST(klass, FL_SINGLETON)) { - klass = rb_ivar_get(klass, id__attached__); if (!RB_TYPE_P(klass, T_CLASS) && !RB_TYPE_P(klass, T_MODULE)) return rb_sprintf("#<%s:%p>", rb_class2name(rb_obj_class(klass)), (void*)klass); } |