Fix generation of JS labels

This commit is contained in:
Alexey Andreev 2017-02-26 20:02:24 +03:00
parent 6d3b329540
commit c6d4265f8b
3 changed files with 3 additions and 2 deletions

View File

@ -216,7 +216,7 @@ public class RenderingContext {
}
public String mainLoopName() {
return minifying ? "$m" : "$main";
return minifying ? "_" : "main";
}
public String tempVarName() {

View File

@ -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();

View File

@ -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;