need to add space for receiver to proc env; fix #2525

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-08-13 23:58:32 +09:00
parent 2b9e5e751b
commit 6c1dfc9566
+1 -1
View File
@@ -41,7 +41,7 @@ closure_setup(mrb_state *mrb, struct RProc *p, int nlocals)
if (!mrb->c->ci->env) {
e = (struct REnv*)mrb_obj_alloc(mrb, MRB_TT_ENV, (struct RClass*)mrb->c->ci->proc->env);
MRB_ENV_STACK_LEN(e)= (unsigned int)nlocals;
MRB_ENV_STACK_LEN(e) = (unsigned int)nlocals+1; /* add space for receiver */
e->mid = mrb->c->ci->mid;
e->cioff = mrb->c->ci - mrb->c->cibase;
e->stack = mrb->c->stack;