Skip to content

Commit 2cbbca7

Browse files
Chouserstuarthalloway
authored andcommitted
Emit finally exception table entry for each try/catch clause. Refs #422
Signed-off-by: Stuart Halloway <[email protected]>
1 parent 3a3374f commit 2cbbca7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/jvm/clojure/lang/Compiler.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,6 @@ public Object eval() throws Exception{
17191719
public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
17201720
Label startTry = gen.newLabel();
17211721
Label endTry = gen.newLabel();
1722-
Label endTryCatch = gen.newLabel();
17231722
Label end = gen.newLabel();
17241723
Label ret = gen.newLabel();
17251724
Label finallyLabel = gen.newLabel();
@@ -1755,7 +1754,6 @@ public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
17551754
finallyExpr.emit(C.STATEMENT, objx, gen);
17561755
gen.goTo(ret);
17571756
}
1758-
gen.mark(endTryCatch);
17591757
if(finallyExpr != null)
17601758
{
17611759
gen.mark(finallyLabel);
@@ -1775,7 +1773,14 @@ public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
17751773
gen.visitTryCatchBlock(startTry, endTry, clause.label, clause.c.getName().replace('.', '/'));
17761774
}
17771775
if(finallyExpr != null)
1778-
gen.visitTryCatchBlock(startTry, endTryCatch, finallyLabel, null);
1776+
{
1777+
gen.visitTryCatchBlock(startTry, endTry, finallyLabel, null);
1778+
for(int i = 0; i < catchExprs.count(); i++)
1779+
{
1780+
CatchClause clause = (CatchClause) catchExprs.nth(i);
1781+
gen.visitTryCatchBlock(clause.label, clause.endLabel, finallyLabel, null);
1782+
}
1783+
}
17791784
for(int i = 0; i < catchExprs.count(); i++)
17801785
{
17811786
CatchClause clause = (CatchClause) catchExprs.nth(i);

0 commit comments

Comments
 (0)