mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
instance_eval should pass the receiver as a block parameter; close #3029
This commit is contained in:
@@ -510,11 +510,13 @@ eval_under(mrb_state *mrb, mrb_value self, mrb_value blk, struct RClass *c)
|
||||
}
|
||||
ci = mrb->c->ci;
|
||||
if (ci->acc == CI_ACC_DIRECT) {
|
||||
return mrb_yield_with_class(mrb, blk, 0, 0, self, c);
|
||||
return mrb_yield_with_class(mrb, blk, 1, &self, self, c);
|
||||
}
|
||||
ci->target_class = c;
|
||||
p = mrb_proc_ptr(blk);
|
||||
ci->proc = p;
|
||||
ci->argc = 1;
|
||||
mrb->c->stack[1] = self;
|
||||
if (MRB_PROC_CFUNC_P(p)) {
|
||||
return p->body.func(mrb, self);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user