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 670c15c6e..390824005 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 @@ -182,7 +182,7 @@ public class Renderer implements RenderingManager { private void renderRuntimeString() throws IOException { MethodReference stringCons = new MethodReference(String.class, "", char[].class, void.class); writer.append("function $rt_str(str) {").indent().softNewLine(); - writer.append("if (str===null){").indent().softNewLine(); + writer.append("if (str == null) {").indent().softNewLine(); writer.append("return null;").softNewLine(); writer.outdent().append("}").softNewLine(); writer.append("var characters = $rt_createCharArray(str.length);").softNewLine(); 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 0925e8ae0..c3fc58b11 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 @@ -458,7 +458,7 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor { ? currentMethod.getVariables().get(index) : null; if (variable != null && variable.getName() != null) { - String result = RenderingUtil.escapeName(variable.getName()); + String result = "$" + RenderingUtil.escapeName(variable.getName()); if (keywords.contains(result) || !usedVariableNames.add(result)) { String base = result; int suffix = 0;