instance_eval should pass the receiver as a block parameter; close #3029

parent 879e27d0
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment