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 (patch) | |
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
Notes:
Merged: https://github.com/ruby/ruby/pull/7308
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r-- | vm_backtrace.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c index cfd1bb3e34..b3218e6735 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -11,6 +11,7 @@ #include "eval_intern.h" #include "internal.h" +#include "internal/class.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__); + klass = RCLASS_ATTACHED_OBJECT(klass); 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); } |