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

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-01-02 22:01:00 +09:00
parent 879e27d0f1
commit aa1f668b80
+3 -1
View File
@@ -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);
}