mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 21:38:10 +00:00
AS1/2: continue, break fix
This commit is contained in:
@@ -494,14 +494,20 @@ public class Action {
|
||||
loopStack.add(stripped.substring(0, stripped.length() - 1));
|
||||
}
|
||||
if (stripped.startsWith("break ")) {
|
||||
if (stripped.equals("break " + loopStack.peek() + ";")) {
|
||||
parts[p] = parts[p].replace(" " + loopStack.peek(), "");
|
||||
if (stripped.equals("break " + loopStack.peek().replace("switch", "") + ";")) {
|
||||
parts[p] = parts[p].replace(" " + loopStack.peek().replace("switch", ""), "");
|
||||
}
|
||||
}
|
||||
if (stripped.startsWith("continue ")) {
|
||||
if (loopStack.size() > 0) {
|
||||
if (stripped.equals("continue " + loopStack.peek() + ";")) {
|
||||
parts[p] = parts[p].replace(" " + loopStack.peek(), "");
|
||||
int pos=loopStack.size()-1;
|
||||
String loopname="";
|
||||
do{
|
||||
loopname=loopStack.get(pos);
|
||||
pos--;
|
||||
}while((pos>=0)&&(loopname.startsWith("loopswitch")));
|
||||
if (stripped.equals("continue " + loopname + ";")) {
|
||||
parts[p] = parts[p].replace(" " + loopname, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ public class BreakTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return hilight("break") + " loop" + loopPos;
|
||||
return hilight("break") + " loop" + loopPos+";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@ public class ContinueTreeItem extends TreeItem {
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
return hilight(isBreak ? "break" : "continue") + " " + (isKnown ? "loop" : "unk") + loopPos;
|
||||
return hilight(isBreak ? "break" : "continue") + " " + (isKnown ? "loop" : "unk") + loopPos+";";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SwitchTreeItem extends LoopTreeItem implements Block {
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
String ret = "";
|
||||
ret += "loop" + loopBreak + ":\r\n";
|
||||
ret += "loopswitch" + loopBreak + ":\r\n";
|
||||
ret += hilight("switch(") + switchedObject.toString(constants) + hilight(")") + "\r\n{\r\n";
|
||||
for (int i = 0; i < caseValues.size(); i++) {
|
||||
ret += "case " + caseValues.get(i).toString(constants) + ":\r\n";
|
||||
|
||||
Reference in New Issue
Block a user