mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
execute ensure clause only when skipping call frame; fix #2726
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user