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
+2 -1
View File
@@ -176,7 +176,8 @@ typedef struct {
uint8_t n:4; /* (15=*) c=n|nk<<4 */
uint8_t nk:4; /* (15=*) */
uint8_t cci; /* called from C function */
uint8_t vis; /* visibility in the current scope */
uint8_t vis; /* 5(ZERO):1(separate module):2(method visibility) */
/* under 3-bit flags are copied to env, and after that, env takes precedence */
mrb_sym mid;
const struct RProc *proc;
struct RProc *blk;