Search in sources :

Example 1 with SwitchIntermediate

use of org.candle.decompiler.intermediate.code.SwitchIntermediate in project candle-decompiler by bradsdavis.

the class CaseEndRangeIntermediateVisitor method visitCaseIntermediate.

@Override
public void visitCaseIntermediate(CaseIntermediate line) {
    SwitchIntermediate si = (SwitchIntermediate) igc.getSinglePredecessor(line);
    List<CaseIntermediate> switchCases = igc.getCases(si);
    int position = line.getBlockRange().getStart().getPosition();
    CaseIntermediate next = findNextCase(switchCases, position);
    if (next != null) {
        line.getBlockRange().setEnd(next.getBlockRange().getStart().getPrev());
    } else {
        //we should get the end from the parent.
        line.getBlockRange().setEnd(si.getBlockRange().getEnd());
    }
}
Also used : SwitchIntermediate(org.candle.decompiler.intermediate.code.SwitchIntermediate) CaseIntermediate(org.candle.decompiler.intermediate.code.CaseIntermediate)

Example 2 with SwitchIntermediate

use of org.candle.decompiler.intermediate.code.SwitchIntermediate in project candle-decompiler by bradsdavis.

the class MultiConditionalToSwitchIntermediate method visitMultiBranchIntermediate.

@Override
public void visitMultiBranchIntermediate(MultiBranchIntermediate line) {
    SwitchIntermediate si = new SwitchIntermediate(line.getInstruction(), line);
    igc.getGraph().addVertex(si);
    igc.redirectPredecessors(line, si);
    igc.redirectSuccessors(line, si);
    igc.getGraph().removeVertex(line);
}
Also used : SwitchIntermediate(org.candle.decompiler.intermediate.code.SwitchIntermediate)

Aggregations

SwitchIntermediate (org.candle.decompiler.intermediate.code.SwitchIntermediate)2 CaseIntermediate (org.candle.decompiler.intermediate.code.CaseIntermediate)1