Commit 0e23038a authored by h2so5's avatar h2so5

execute ensure clause correctly without OP_EPOP

parent 0b92025c
......@@ -264,7 +264,7 @@ ecall(mrb_state *mrb, int i)
p = mrb->c->ensure[i];
if (!p) return;
if (mrb->c->ci->eidx < i)
if (mrb->c->ci->eidx > i)
mrb->c->ci->eidx = i;
ci = cipush(mrb);
ci->stackidx = mrb->c->stack - mrb->c->stbase;
......@@ -857,9 +857,10 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int
/* A A.times{ensure_pop().call} */
int n;
int a = GETARG_A(i);
mrb_callinfo *ci = mrb->c->ci;
for (n=0; n<a; n++) {
ecall(mrb, --mrb->c->ci->eidx);
for (n=0; n<a && ci->eidx > ci[-1].eidx; n++) {
ecall(mrb, --ci->eidx);
ARENA_RESTORE(mrb, ai);
}
NEXT;
......
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