Search in sources :

Example 1 with ElseIfBlock

use of org.candle.decompiler.ast.conditional.ElseIfBlock in project candle-decompiler by bradsdavis.

the class BlockVisitor method visitElseIfIntermediate.

@Override
public void visitElseIfIntermediate(ElseIfIntermediate line) {
    if (seen.contains(line)) {
        // do nothing.
        return;
    } else {
        seen.add(line);
    }
    ElseIfBlock elseIfBlock = new ElseIfBlock(line);
    current.addChild(elseIfBlock);
    this.current = elseIfBlock;
    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 = elseIfBlock;
    falseOutcome.accept(this);
    if (this.current == elseIfBlock) {
        moveUp();
    }
}
Also used : AbstractIntermediate(org.candle.decompiler.intermediate.code.AbstractIntermediate) ElseIfBlock(org.candle.decompiler.ast.conditional.ElseIfBlock)

Aggregations

ElseIfBlock (org.candle.decompiler.ast.conditional.ElseIfBlock)1 AbstractIntermediate (org.candle.decompiler.intermediate.code.AbstractIntermediate)1