use of org.candle.decompiler.ast.conditional.IfBlock in project candle-decompiler by bradsdavis.
the class BlockVisitor method visitIfIntermediate.
@Override
public void visitIfIntermediate(IfIntermediate line) {
if (seen.contains(line)) {
// do nothing.
return;
} else {
seen.add(line);
}
IfBlock ifBlock = new IfBlock(line);
current.addChild(ifBlock);
this.current = ifBlock;
List<AbstractIntermediate> successors = getUnseenSuccessors(line);
// assign true... and go through true.
AbstractIntermediate trueOutcome = igc.getTrueTarget(line);
AbstractIntermediate falseOutcome = igc.getFalseTarget(line);
/*
for(AbstractIntermediate successor : successors) {
if(successor instanceof BooleanBranchOutcome) {
if(((BooleanBranchOutcome) successor).getExpressionOutcome() == Boolean.TRUE) {
trueOutcome = (BooleanBranchOutcome)successor;
}
else {
falseOutcome = (BooleanBranchOutcome)successor;
}
}
else {
throw new IllegalStateException("Outcome of If expected to be boolean.");
}
}*/
trueOutcome.accept(this);
// now, go back to if...
this.current = ifBlock;
falseOutcome.accept(this);
if (this.current == ifBlock) {
moveUp();
}
}
Aggregations