mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
class.h: rename macros for clarity
- MRB_SET_VISIBILITY -> MRB_CLASS_SET_VISIBILITY - MRB_VISIBILITY -> MRB_CLASS_VISIBILITY
This commit is contained in:
@@ -79,8 +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)
|
||||
#define MRB_CLASS_SET_VISIBILITY(c,v) ((c)->flags = (((c)->flags & ~(0x3<<7)) | (((v)&0x3)<<7)))
|
||||
#define MRB_CLASS_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);
|
||||
|
||||
+3
-3
@@ -353,7 +353,7 @@ setup_class(mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb_sym id)
|
||||
{
|
||||
mrb_class_name_class(mrb, outer, c, id);
|
||||
mrb_obj_iv_set(mrb, (struct RObject*)outer, id, mrb_obj_value(c));
|
||||
MRB_SET_VISIBILITY(c, MT_PUBLIC);
|
||||
MRB_CLASS_SET_VISIBILITY(c, MT_PUBLIC);
|
||||
}
|
||||
|
||||
#define make_metaclass(mrb, c) prepare_singleton_class((mrb), (struct RBasic*)(c))
|
||||
@@ -787,7 +787,7 @@ mrb_define_method_raw(mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_method_
|
||||
flags = (flags & ~MT_VMASK) | MT_PRIVATE;
|
||||
}
|
||||
else if ((flags & MT_VMASK) == 0) {
|
||||
flags |= MRB_VISIBILITY(c);
|
||||
flags |= MRB_CLASS_VISIBILITY(c);
|
||||
}
|
||||
mt_put(mrb, h, mid, flags, ptr);
|
||||
mc_clear_by_id(mrb, mid);
|
||||
@@ -1673,7 +1673,7 @@ mrb_mod_visibility(mrb_state *mrb, mrb_value mod, int visibility)
|
||||
|
||||
mrb_get_args(mrb, "*!", &argv, &argc);
|
||||
if (argc == 0) {
|
||||
MRB_SET_VISIBILITY(c, visibility);
|
||||
MRB_CLASS_SET_VISIBILITY(c, visibility);
|
||||
}
|
||||
else {
|
||||
mt_tbl *h = c->mt;
|
||||
|
||||
@@ -1011,7 +1011,7 @@ mrb_mod_module_eval(mrb_state *mrb, mrb_value mod)
|
||||
if (mrb_get_args(mrb, "|S&", &a, &b) == 1) {
|
||||
mrb_raise(mrb, E_NOTIMP_ERROR, "module_eval/class_eval with string not implemented");
|
||||
}
|
||||
MRB_SET_VISIBILITY(mrb_class_ptr(mod), MRB_METHOD_PUBLIC_FL);
|
||||
MRB_CLASS_SET_VISIBILITY(mrb_class_ptr(mod), MRB_METHOD_PUBLIC_FL);
|
||||
return eval_under(mrb, mod, b, mrb_class_ptr(mod));
|
||||
}
|
||||
|
||||
@@ -2942,7 +2942,7 @@ RETRY_TRY_BLOCK:
|
||||
const mrb_irep *nirep = irep->reps[b];
|
||||
|
||||
/* restore visibility */
|
||||
MRB_SET_VISIBILITY(c, MRB_METHOD_PUBLIC_FL);
|
||||
MRB_CLASS_SET_VISIBILITY(c, MRB_METHOD_PUBLIC_FL);
|
||||
|
||||
/* prepare closure */
|
||||
struct RProc *p = mrb_proc_new(mrb, nirep);
|
||||
|
||||
Reference in New Issue
Block a user