Fixed AS1/2 - switch with nontrivial expressions like and/or,ternar (second pass)

This commit is contained in:
Jindra Petřík
2021-11-28 10:00:30 +01:00
parent 0122db9446
commit 526f484513
115 changed files with 443 additions and 140 deletions

View File

@@ -537,6 +537,13 @@ public class Graph {
List<GraphTargetItem> ret = printGraph(gotos, new HashMap<>(), new HashMap<>(), new HashSet<>(), localData, stack, allParts, null, heads.get(0), null, null, loops, throwStates, staticOperation, path);
if (localData.secondPassData == null) {
SecondPassData secondPassData = prepareSecondPass(ret);
if (secondPassData != null) {
throw new SecondPassException(secondPassData);
}
}
processIfGotos2(new ArrayList<>(), gotos, ret, ret);
processIfGotos(gotos, ret, ret);
@@ -556,7 +563,6 @@ public class Graph {
}
}
expandGotos(ret);
//processSwitches(ret);
processIfs(ret);
finalProcessStack(stack, ret, path);
makeAllCommands(ret, stack);
@@ -568,6 +574,10 @@ public class Graph {
processSwitches(list, -1);
}
protected SecondPassData prepareSecondPass(List<GraphTargetItem> list) {
return null;
}
/*
while(something){
@@ -2423,6 +2433,9 @@ public class Graph {
if (isIf) {
makeAllCommands(currentRet, stack);
IfItem b = new IfItem(null, localData.lineStartInstruction, expr.invert(null), onTrue, onFalse);
b.decisionPart = part;
b.onTruePart = nps.get(0);
b.onFalsePart = nps.get(1);
currentRet.add(b);
if (processSubBlk(b, null)) {
stack.push(new PopItem(null, localData.lineStartInstruction));