Search in sources :

Example 1 with ContinuousWhileIntermediate

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

the class ContinuousLoop method process.

@Override
public void process(InstructionHandle ih) {
    List<InstructionHandle> preds = Graphs.predecessorListOf(igc.getGraph(), ih);
    //only more than one predecessor.
    if (preds.size() < 2) {
        return;
    }
    for (InstructionHandle pred : preds) {
        IntermediateEdge ie = igc.getGraph().getEdge(pred, ih);
        if (ie.getType() == EdgeType.BACK) {
            if (!igc.hasIntermediate(ih)) {
                //this is probably a while(true);
                ContinuousWhileIntermediate cwi = new ContinuousWhileIntermediate(ih);
                igc.addIntermediate(ih, cwi);
                break;
            }
        }
    }
}
Also used : ContinuousWhileIntermediate(org.candle.decompiler.intermediate.code.loop.ContinuousWhileIntermediate) IntermediateEdge(org.candle.decompiler.intermediate.graph.edge.IntermediateEdge) InstructionHandle(org.apache.bcel.generic.InstructionHandle)

Aggregations

InstructionHandle (org.apache.bcel.generic.InstructionHandle)1 ContinuousWhileIntermediate (org.candle.decompiler.intermediate.code.loop.ContinuousWhileIntermediate)1 IntermediateEdge (org.candle.decompiler.intermediate.graph.edge.IntermediateEdge)1