diff options
author | Jean Boussier <byroot@ruby-lang.org> | 2023-02-15 10:42:52 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-02-15 15:24:22 +0100 |
commit | 7413079dae81e46aefc948cd8872497567945791 (patch) | |
tree | 31c1118b1bd5d751940571505ff5db1058d612e4 /vm.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.c')
-rw-r--r-- | vm.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -12,6 +12,7 @@ #include "eval_intern.h" #include "internal.h" +#include "internal/class.h" #include "internal/compile.h" #include "internal/cont.h" #include "internal/error.h" @@ -542,7 +543,7 @@ rb_dtrace_setup(rb_execution_context_t *ec, VALUE klass, ID id, klass = RBASIC(klass)->klass; } else if (FL_TEST(klass, FL_SINGLETON)) { - klass = rb_attr_get(klass, id__attached__); + klass = RCLASS_ATTACHED_OBJECT(klass); if (NIL_P(klass)) return FALSE; } type = BUILTIN_TYPE(klass); |