Fixed: #2636 ActionScript - switches vs loop breaks

This commit is contained in:
Jindra Petřík
2026-02-18 19:46:35 +01:00
parent 7bc96f67f3
commit fab6defe9c
12 changed files with 16 additions and 56 deletions

View File

@@ -1433,11 +1433,10 @@ public class Graph {
* @return Second pass data or null
*/
protected SecondPassData prepareSecondPass(BaseLocalData localData, List<GraphTargetItem> list) {
if (localData.allSwitchParts.isEmpty() && !localData.gotosUsed.getVal()) {
if (!localData.gotosUsed.getVal()) {
return null;
}
SecondPassData spd = new SecondPassData();
spd.allSwitchParts.addAll(localData.allSwitchParts);
return spd;
}
@@ -2998,19 +2997,7 @@ public class Graph {
Map<GraphPart, Integer> count = new HashMap<>();
GraphPart winner = null;
int winnerCount = 0;
int winnerNumBlock = Integer.MAX_VALUE;
Set<GraphPart> bannedCandidates = new HashSet<>();
if (localData.secondPassData != null) {
bannedCandidates = localData.secondPassData.allSwitchParts;
}
if (debugPrintLoopList) {
System.err.println("bannedCandidates:");
for (GraphPart p : bannedCandidates) {
System.err.println("- " + p);
}
}
int winnerNumBlock = Integer.MAX_VALUE;
for (GraphPart cand : currentLoop.breakCandidates) {
if (removedX.contains(cand)) {
@@ -3019,12 +3006,6 @@ public class Graph {
}
continue;
}
if (bannedCandidates.contains(cand)) {
if (debugPrintLoopList) {
System.err.println("cand " + cand + " is banned");
}
continue;
}
if (!count.containsKey(cand)) {
count.put(cand, 0);
}
@@ -4956,8 +4937,6 @@ public class Graph {
}
}
localData.allSwitchParts.add(caseBodies.get(i));
List<GraphPart> stopPart2x = new ArrayList<>(stopPart);
List<StopPartKind> stopPartKind2x = new ArrayList<>(stopPartKind);
for (GraphPart b : caseBodies) {