diff --git a/core/src/main/java/org/teavm/backend/javascript/rendering/Renderer.java b/core/src/main/java/org/teavm/backend/javascript/rendering/Renderer.java index 390824005..9a499acad 100644 --- a/core/src/main/java/org/teavm/backend/javascript/rendering/Renderer.java +++ b/core/src/main/java/org/teavm/backend/javascript/rendering/Renderer.java @@ -678,7 +678,7 @@ public class Renderer implements RenderingManager { variableNames.add(statementRenderer.variableName(i)); } if (hasTryCatch) { - variableNames.add("$je"); + variableNames.add("$$je"); } if (!variableNames.isEmpty()) { writer.append("var "); @@ -725,7 +725,7 @@ public class Renderer implements RenderingManager { } boolean hasTryCatch = tryCatchFinder.tryCatchFound; if (hasTryCatch) { - variableNames.add("$je"); + variableNames.add("$$je"); } variableNames.add(context.pointerName()); variableNames.add(context.tempVarName()); diff --git a/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java b/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java index c3fc58b11..bc7fbf1c3 100644 --- a/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java +++ b/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java @@ -1355,25 +1355,25 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor { protectedBody = nextStatement.getProtectedBody(); } visitStatements(protectedBody); - writer.outdent().append("}").ws().append("catch").ws().append("($e)") + writer.outdent().append("}").ws().append("catch").ws().append("($$e)") .ws().append("{").indent().softNewLine(); - writer.append("$je").ws().append("=").ws().append("$e.$javaException;").softNewLine(); + writer.append("$$je").ws().append("=").ws().append("$$e.$javaException;").softNewLine(); for (TryCatchStatement catchClause : sequence) { - writer.append("if").ws().append("($je"); + writer.append("if").ws().append("($$je"); if (catchClause.getExceptionType() != null) { - writer.ws().append("&&").ws().append("$je instanceof ") + writer.ws().append("&&").ws().append("$$je instanceof ") .appendClass(catchClause.getExceptionType()); } writer.append(")").ws().append("{").indent().softNewLine(); if (catchClause.getExceptionVariable() != null) { writer.append(variableName(catchClause.getExceptionVariable())).ws().append("=").ws() - .append("$je;").softNewLine(); + .append("$$je;").softNewLine(); } visitStatements(catchClause.getHandler()); writer.outdent().append("}").ws().append("else "); } writer.append("{").indent().softNewLine(); - writer.append("throw $e;").softNewLine(); + writer.append("throw $$e;").softNewLine(); writer.outdent().append("}").softNewLine(); writer.outdent().append("}").softNewLine(); } catch (IOException e) {