From 43acca87062c568aee128b905c64cb732284fe0d Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Wed, 26 Feb 2014 22:02:09 +0400 Subject: [PATCH] Fixes incorrect optimization of try/catch statements --- .../main/java/org/teavm/javascript/OptimizingVisitor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java b/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java index 60e720691..f1dfa0009 100644 --- a/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java +++ b/teavm-core/src/main/java/org/teavm/javascript/OptimizingVisitor.java @@ -551,8 +551,12 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor { @Override public void visit(TryCatchStatement statement) { - processSequence(statement.getProtectedBody()); - processSequence(statement.getHandler()); + List statements = processSequence(statement.getProtectedBody()); + statement.getProtectedBody().clear(); + statement.getProtectedBody().addAll(statements); + statements = processSequence(statement.getHandler()); + statement.getHandler().clear(); + statement.getHandler().addAll(statements); resultStmt = statement; } }