mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-23 16:05:31 +00:00
@@ -60,6 +60,26 @@ public class ForEachInAVM2Item extends LoopItem implements Block {
|
||||
|
||||
public ForEachInAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Loop loop, InAVM2Item expression, List<GraphTargetItem> commands) {
|
||||
super(instruction, lineStartIns, loop);
|
||||
|
||||
/*
|
||||
Following was commented out:
|
||||
|
||||
The code should fix following:
|
||||
for each (var a in col)
|
||||
{
|
||||
var b = a; //a is temp reg
|
||||
trace(b);
|
||||
}
|
||||
|
||||
but fails for following:
|
||||
for each (var a in col)
|
||||
{
|
||||
c[a] = a;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
/*
|
||||
if (!commands.isEmpty()) {
|
||||
GraphTargetItem firstAssign = commands.get(0);
|
||||
if (firstAssign instanceof SetTypeAVM2Item) {
|
||||
@@ -74,7 +94,7 @@ public class ForEachInAVM2Item extends LoopItem implements Block {
|
||||
}
|
||||
//locAssign.
|
||||
}
|
||||
}
|
||||
}*/
|
||||
this.expression = expression;
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
@@ -186,33 +186,31 @@ public class Graph {
|
||||
//case (A), new
|
||||
GraphPart nh = trav_loops_DFS(localData, loopHeaders, b, DFSP_pos + 1);
|
||||
tag_lhead(b0, nh);
|
||||
} else if (b.DFSP_pos > 0) { // b in DFSP(b0)
|
||||
//case (B)
|
||||
if (b.type != GraphPart.TYPE_LOOP_HEADER) {
|
||||
b.type = GraphPart.TYPE_LOOP_HEADER;
|
||||
loopHeaders.add(b);
|
||||
}
|
||||
tag_lhead(b0, b);
|
||||
} else if (b.iloop_header == null) {
|
||||
//case (C), do nothing
|
||||
} else {
|
||||
if (b.DFSP_pos > 0) { // b in DFSP(b0)
|
||||
//case (B)
|
||||
if (b.type != GraphPart.TYPE_LOOP_HEADER) {
|
||||
b.type = GraphPart.TYPE_LOOP_HEADER;
|
||||
loopHeaders.add(b);
|
||||
}
|
||||
tag_lhead(b0, b);
|
||||
} else if (b.iloop_header == null) {
|
||||
//case (C), do nothing
|
||||
} else {
|
||||
GraphPart h = b.iloop_header;
|
||||
if (h.DFSP_pos > 0) { // h in DFSP(b0)
|
||||
//case (D)
|
||||
tag_lhead(b0, h);
|
||||
} else { // h not in DFSP(b0)
|
||||
//case (E), reentry
|
||||
b.type = GraphPart.TYPE_REENTRY; //TODO:and b0,b ?
|
||||
h.irreducible = true;
|
||||
while (h.iloop_header != null) {
|
||||
h = h.iloop_header;
|
||||
if (h.DFSP_pos > 0) { //h in DFSP(b0)
|
||||
tag_lhead(b0, h);
|
||||
break;
|
||||
}
|
||||
h.irreducible = true;
|
||||
GraphPart h = b.iloop_header;
|
||||
if (h.DFSP_pos > 0) { // h in DFSP(b0)
|
||||
//case (D)
|
||||
tag_lhead(b0, h);
|
||||
} else { // h not in DFSP(b0)
|
||||
//case (E), reentry
|
||||
b.type = GraphPart.TYPE_REENTRY; //TODO:and b0,b ?
|
||||
h.irreducible = true;
|
||||
while (h.iloop_header != null) {
|
||||
h = h.iloop_header;
|
||||
if (h.DFSP_pos > 0) { //h in DFSP(b0)
|
||||
tag_lhead(b0, h);
|
||||
break;
|
||||
}
|
||||
h.irreducible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1753,6 +1751,10 @@ public class Graph {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (to.expression instanceof FalseItem) {
|
||||
it = to.onFalse;
|
||||
} else if (to.expression instanceof TrueItem) {
|
||||
it = to.onTrue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -1801,10 +1803,6 @@ public class Graph {
|
||||
GraphPart defaultPart = hasExpr ? part.nextParts.get(1 + defaultBranch) : part.nextParts.get(0);
|
||||
|
||||
for (int i = 1; i < part.nextParts.size(); i++) {
|
||||
if (hasExpr && i == 1 + defaultBranch) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (part.nextParts.get(i) != defaultPart) {
|
||||
if (caseExpressions.containsKey(pos)) {
|
||||
caseValues.add(caseExpressions.get(pos));
|
||||
@@ -1812,7 +1810,6 @@ public class Graph {
|
||||
caseValues.add(new IntegerValueItem(null, localData.lineStartInstruction, pos));
|
||||
}
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
@@ -1862,12 +1859,10 @@ public class Graph {
|
||||
}
|
||||
vis.add(p);
|
||||
}
|
||||
} else if (p == defaultPart) {
|
||||
defaultCommands = nextCommands;
|
||||
} else {
|
||||
if (p == defaultPart) {
|
||||
defaultCommands = nextCommands;
|
||||
} else {
|
||||
caseCommands.add(nextCommands);
|
||||
}
|
||||
caseCommands.add(nextCommands);
|
||||
}
|
||||
first = false;
|
||||
pos++;
|
||||
|
||||
Reference in New Issue
Block a user