mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fixed visibility at method definition
There was a problem with visibility state from proc that straddles a fiber or is independent. Therefore, it has been changed to give priority to env objects, if any. Also, added "separate module" flag to block traversal to a higher level env object. Note that the "separate module" flag is now set when calling blocks with the `mrb_yield_with_class()` function. fixed https://github.com/mruby/mruby/issues/6494
This commit is contained in:
@@ -30,13 +30,17 @@ struct REnv {
|
||||
mrb_sym mid;
|
||||
};
|
||||
|
||||
/* flags (21bits): 5(ZERO):8(cioff/bidx):8(stack_len) */
|
||||
/* flags (20bits): 1(ZERO):1(separate module):2(visibility):8(cioff/bidx):8(stack_len) */
|
||||
#define MRB_ENV_SET_LEN(e,len) ((e)->flags = (((e)->flags & ~0xff)|((unsigned int)(len) & 0xff)))
|
||||
#define MRB_ENV_LEN(e) ((mrb_int)((e)->flags & 0xff))
|
||||
#define MRB_ENV_CLOSE(e) ((e)->cxt = NULL)
|
||||
#define MRB_ENV_ONSTACK_P(e) ((e)->cxt != NULL)
|
||||
#define MRB_ENV_BIDX(e) (((e)->flags >> 8) & 0xff)
|
||||
#define MRB_ENV_SET_BIDX(e,idx) ((e)->flags = (((e)->flags & ~(0xff<<8))|((unsigned int)(idx) & 0xff)<<8))
|
||||
#define MRB_ENV_SET_VISIBILITY(e, vis) MRB_FLAGS_SET((e)->flags, 16, 2, vis)
|
||||
#define MRB_ENV_VISIBILITY(e) MRB_FLAGS_GET((e)->flags, 16, 2)
|
||||
#define MRB_ENV_SEPARATE_MODULE_P(e) MRB_FLAG_P((e)->flags, 18)
|
||||
#define MRB_ENV_COPY_FLAGS_FROM_CI(e, ci) MRB_FLAGS_SET((e)->flags, 16, 3, (ci)->vis)
|
||||
|
||||
/*
|
||||
* Returns TRUE on success.
|
||||
|
||||
Reference in New Issue
Block a user