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:
dearblue
2025-04-09 22:20:33 +09:00
parent 52de3b7e10
commit 3fd5e1c250
12 changed files with 169 additions and 34 deletions
+8
View File
@@ -94,6 +94,14 @@ struct mrb_state;
# define MRB_PRIx PRIx32
#endif
#define MRB_FLAGS_MASK(shift, width) (~(~0U << (width)) << (shift))
#define MRB_FLAGS_GET(b, s, w) (((b) >> (s)) & MRB_FLAGS_MASK(0, w))
#define MRB_FLAGS_SET(b, s, w, n) ((b) = MRB_FLAGS_INVERT_TRIM(b, s, w) | MRB_FLAGS_MAKE(s, w, n))
#define MRB_FLAGS_INVERT_TRIM(b, s, w) ((b) & ~MRB_FLAGS_MASK(s, w))
#define MRB_FLAGS_MAKE(s, w, n) (((n) & MRB_FLAGS_MASK(0, w)) << (s))
#define MRB_FLAG_ENABLE(b, s) ((b) |= MRB_FLAGS_MASK(s, 1))
#define MRB_FLAG_P(b, s) (!!((b) & MRB_FLAGS_MASK(s, 1)))
MRB_API mrb_bool mrb_read_int(const char *p, const char *e, char **endp, mrb_int *np);
/* obsolete; do not use mrb_int_read() */
MRB_API mrb_int mrb_int_read(const char*, const char*, char**);