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_method.c | |
parent | bac4d2eefa079168968841079727fe2289b6ab6e (diff) | |
download | ruby-7413079dae81e46aefc948cd8872497567945791.tar.gz |
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.
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c index 802e327da2..9af240a2cc 100644 --- a/vm_method.c +++ b/vm_method.c @@ -19,7 +19,6 @@ static inline rb_method_entry_t *lookup_method_table(VALUE klass, ID id); #define singleton_removed idSingleton_method_removed #define undefined idMethod_undefined #define singleton_undefined idSingleton_method_undefined -#define attached id__attached__ #define ruby_running (GET_VM()->running) /* int ruby_running = 0; */ @@ -1086,7 +1085,7 @@ check_overloaded_cme(const rb_callable_method_entry_t *cme, const struct rb_call VALUE recv_class = (klass); \ ID hook_id = (hook); \ if (FL_TEST((klass), FL_SINGLETON)) { \ - recv_class = rb_ivar_get((klass), attached); \ + recv_class = RCLASS_ATTACHED_OBJECT((klass)); \ hook_id = singleton_##hook; \ } \ rb_funcallv(recv_class, hook_id, 1, &arg); \ |