diff --git a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java index 0e401c21c..cd6a0bd6b 100644 --- a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java +++ b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java @@ -216,7 +216,7 @@ public class RenderingContext { } public String mainLoopName() { - return minifying ? "$m" : "$main"; + return minifying ? "_" : "main"; } public String tempVarName() { diff --git a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java index 226925e95..5e6fdd700 100644 --- a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java +++ b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingUtil.java @@ -76,6 +76,7 @@ public final class RenderingUtil { public static String indexToId(int index) { StringBuilder sb = new StringBuilder(); sb.append(variableNames.charAt(index % variableNames.length())); + index /= variableNames.length(); while (index > 0) { sb.append(variablePartNames.charAt(index % variablePartNames.length())); index /= variablePartNames.length(); 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 8b556b302..0c6d7c5bb 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 @@ -307,7 +307,7 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor { String name = blockIdMap.get(id); if (name == null) { int index = blockIdMap.size(); - name = "$b" + RenderingUtil.indexToId(index); + name = RenderingUtil.indexToId(index); blockIdMap.put(id, name); } return name;