mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 18:48:07 +00:00
Fixed: #2519 AS1/2 avoid multi-level loops in cases where possible
This commit is contained in:
@@ -3287,7 +3287,13 @@ public class Graph {
|
||||
System.err.println("Adding break");
|
||||
}
|
||||
makeAllCommands(ret, stack);
|
||||
ret.add(new BreakItem(dialect, null, localData.lineStartInstruction, el.id));
|
||||
|
||||
BreakItem br = new BreakItem(dialect, null, localData.lineStartInstruction, el.id);
|
||||
if (part.start >= code.size() - 1) {
|
||||
br.isScriptEnd = true;
|
||||
}
|
||||
ret.add(br);
|
||||
|
||||
return ret;
|
||||
}
|
||||
if (el.loopPreContinue == part) {
|
||||
|
||||
@@ -44,6 +44,11 @@ public class BreakItem extends GraphTargetItem {
|
||||
*/
|
||||
private boolean labelRequired;
|
||||
|
||||
/**
|
||||
* Is placed at end of the script (or function)
|
||||
*/
|
||||
public boolean isScriptEnd = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -59,6 +64,10 @@ public class BreakItem extends GraphTargetItem {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
if (isScriptEnd) {
|
||||
writer.append("return");
|
||||
return writer;
|
||||
}
|
||||
writer.append("break");
|
||||
if (writer instanceof NulWriter) {
|
||||
NulWriter nulWriter = (NulWriter) writer;
|
||||
|
||||
Reference in New Issue
Block a user