execute ensure clause only when skipping call frame; fix #2726

This commit is contained in:
Yukihiro "Matz" Matsumoto
2015-03-21 11:20:44 +09:00
parent 0e218f5356
commit 4cf9b2fd1c
+7 -6
View File
@@ -1474,12 +1474,7 @@ RETRY_TRY_BLOCK:
mrb->jmp = prev_jmp;
MRB_THROW(prev_jmp);
}
if (ci > mrb->c->cibase) {
while (eidx > ci[-1].eidx) {
ecall(mrb, --eidx);
}
}
else if (ci == mrb->c->cibase) {
if (ci == mrb->c->cibase) {
if (ci->ridx == 0) {
if (mrb->c == mrb->root_c) {
regs = mrb->c->stack = mrb->c->stbase;
@@ -1495,6 +1490,12 @@ RETRY_TRY_BLOCK:
}
break;
}
/* call ensure only when we skip this callinfo */
if (ci[0].ridx == ci[-1].ridx) {
while (eidx > ci[-1].eidx) {
ecall(mrb, --eidx);
}
}
}
L_RESCUE:
if (ci->ridx == 0) goto L_STOP;