mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 22:00:45 +00:00
For in break detection with inner switch statement
This commit is contained in:
@@ -56,6 +56,7 @@ import com.jpexs.decompiler.graph.model.ContinueItem;
|
||||
import com.jpexs.decompiler.graph.model.DefaultItem;
|
||||
import com.jpexs.decompiler.graph.model.IfItem;
|
||||
import com.jpexs.decompiler.graph.model.SwitchItem;
|
||||
import com.jpexs.decompiler.graph.model.UniversalLoopItem;
|
||||
import com.jpexs.decompiler.graph.model.WhileItem;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.ArrayList;
|
||||
@@ -140,6 +141,24 @@ public class ActionGraph extends Graph {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canBeBreakCandidate(GraphPart part) {
|
||||
if (part.refs.size() <= 1) {
|
||||
return true;
|
||||
}
|
||||
boolean isSwitch = true;
|
||||
for (GraphPart r : part.refs) {
|
||||
if (code.get(r.end) instanceof ActionIf) {
|
||||
if (!(r.start < r.end - 1 && (code.get(r.end - 1) instanceof ActionStrictEquals))) {
|
||||
isSwitch = false;
|
||||
}
|
||||
} else {
|
||||
isSwitch = false;
|
||||
}
|
||||
}
|
||||
return !isSwitch;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalProcess(List<GraphTargetItem> list, int level, FinalProcessLocalData localData, String path) throws InterruptedException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user