mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-23 23:04:50 -08:00
Fix generation of JS labels
This commit is contained in:
parent
6d3b329540
commit
c6d4265f8b
|
@ -216,7 +216,7 @@ public class RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String mainLoopName() {
|
public String mainLoopName() {
|
||||||
return minifying ? "$m" : "$main";
|
return minifying ? "_" : "main";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String tempVarName() {
|
public String tempVarName() {
|
||||||
|
|
|
@ -76,6 +76,7 @@ public final class RenderingUtil {
|
||||||
public static String indexToId(int index) {
|
public static String indexToId(int index) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(variableNames.charAt(index % variableNames.length()));
|
sb.append(variableNames.charAt(index % variableNames.length()));
|
||||||
|
index /= variableNames.length();
|
||||||
while (index > 0) {
|
while (index > 0) {
|
||||||
sb.append(variablePartNames.charAt(index % variablePartNames.length()));
|
sb.append(variablePartNames.charAt(index % variablePartNames.length()));
|
||||||
index /= variablePartNames.length();
|
index /= variablePartNames.length();
|
||||||
|
|
|
@ -307,7 +307,7 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor {
|
||||||
String name = blockIdMap.get(id);
|
String name = blockIdMap.get(id);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
int index = blockIdMap.size();
|
int index = blockIdMap.size();
|
||||||
name = "$b" + RenderingUtil.indexToId(index);
|
name = RenderingUtil.indexToId(index);
|
||||||
blockIdMap.put(id, name);
|
blockIdMap.put(id, name);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user