class.c: first step to private methods; #1835

Now each method entry holds visibility information in flag bits.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-01-29 17:24:36 +09:00
parent 3a3e877ae5
commit fdf71d8f2d
3 changed files with 61 additions and 13 deletions
+2
View File
@@ -79,6 +79,8 @@ mrb_class(mrb_state *mrb, mrb_value v)
#define MRB_UNDEF_ALLOCATOR(c) (mrb_assert((c)->tt == MRB_TT_CLASS), (c)->flags |= MRB_FL_UNDEF_ALLOCATE)
#define MRB_UNDEF_ALLOCATOR_P(c) ((c)->flags & MRB_FL_UNDEF_ALLOCATE)
#define MRB_DEFINE_ALLOCATOR(c) ((c)->flags &= ~MRB_FL_UNDEF_ALLOCATE)
#define MRB_SET_VISIBILITY(c,v) ((c)->flags = (((c)->flags & ~(0x3<<7)) | (((v)&0x3)<<7)))
#define MRB_VISIBILITY(c) (((c)->flags>>7) & 0x3)
MRB_API void mrb_define_method_raw(mrb_state*, struct RClass*, mrb_sym, mrb_method_t);
MRB_API void mrb_alias_method(mrb_state*, struct RClass *c, mrb_sym a, mrb_sym b);