small fixes
This commit is contained in:
parent
0ea01996ee
commit
396d7ca5a2
@ -27,9 +27,10 @@ public class TryStatement extends Statement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void compile(List<Instruction> target, ScopeRecord scope) {
|
public void compile(List<Instruction> target, ScopeRecord scope) {
|
||||||
|
target.add(Instruction.nop());
|
||||||
|
|
||||||
int start = target.size(), tryN, catchN = -1, finN = -1;
|
int start = target.size(), tryN, catchN = -1, finN = -1;
|
||||||
|
|
||||||
target.add(Instruction.nop());
|
|
||||||
tryBody.compileNoPollution(target, scope);
|
tryBody.compileNoPollution(target, scope);
|
||||||
tryN = target.size() - start;
|
tryN = target.size() - start;
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ public class TryStatement extends Statement {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
target.set(start, Instruction.tryInstr(tryN, catchN, finN).locate(loc()));
|
target.set(start - 1, Instruction.tryInstr(tryN, catchN, finN).locate(loc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TryStatement(Location loc, Statement tryBody, Statement catchBody, Statement finallyBody, String name) {
|
public TryStatement(Location loc, Statement tryBody, Statement catchBody, Statement finallyBody, String name) {
|
||||||
|
@ -195,6 +195,7 @@ public class CodeFrame {
|
|||||||
if (!jumpFlag) {
|
if (!jumpFlag) {
|
||||||
if (tmp.state == TryCtx.STATE_FINALLY_THREW) throw tmp.err;
|
if (tmp.state == TryCtx.STATE_FINALLY_THREW) throw tmp.err;
|
||||||
else if (tmp.state == TryCtx.STATE_FINALLY_RETURNED) return tmp.retVal;
|
else if (tmp.state == TryCtx.STATE_FINALLY_RETURNED) return tmp.retVal;
|
||||||
|
else if (tmp.state == TryCtx.STATE_FINALLY_JUMPED) codePtr = tmp.jumpPtr;
|
||||||
}
|
}
|
||||||
else codePtr = tmp.jumpPtr;
|
else codePtr = tmp.jumpPtr;
|
||||||
remove = true;
|
remove = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user