From 7413079dae81e46aefc948cd8872497567945791 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Wed, 15 Feb 2023 10:42:52 +0100 Subject: 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. --- vm_method.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'vm_method.c') 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); \ -- cgit v1.2.1