use of org.candle.decompiler.intermediate.graph.context.NullIntermediate in project candle-decompiler by bradsdavis.
the class IntermediateTryCatch method generateCatch.
private void generateCatch(TryIntermediate tryIntermediate, CodeExceptionGen ceg) {
LOG.debug("CEG: " + ceg);
//convert the node to catch blocks...
AbstractIntermediate catchDeclaration = igc.getOrderedIntermediate().ceiling(new NullIntermediate(ceg.getHandlerPC()));
LOG.debug("Catch Declaration:" + catchDeclaration);
if (catchDeclaration instanceof StatementIntermediate) {
StatementIntermediate declarationStatement = (StatementIntermediate) catchDeclaration;
if (declarationStatement.getExpression() instanceof Declaration) {
Declaration declaration = (Declaration) declarationStatement.getExpression();
//now, we can convert this into a catch block.
CatchIntermediate catchIntermediate = new CatchIntermediate(declarationStatement.getInstruction(), ceg, declaration.getVariable());
igc.getGraph().addVertex(catchIntermediate);
//redirect statement to catch.
igc.redirectPredecessors(declarationStatement, catchIntermediate);
igc.redirectSuccessors(declarationStatement, catchIntermediate);
//now, we just need to remove the statement.
igc.getGraph().removeVertex(declarationStatement);
//populate the bounds..
//add the link between try and catch.
igc.getGraph().addEdge(tryIntermediate, catchIntermediate);
}
}
}
use of org.candle.decompiler.intermediate.graph.context.NullIntermediate in project candle-decompiler by bradsdavis.
the class IfLowerRangeVisitor method visitIfIntermediate.
@Override
public void visitIfIntermediate(IfIntermediate line) {
AbstractIntermediate l = igc.getTrueTarget(line);
InstructionHandle lower = l.getInstruction();
line.getBlockRange().setStart(lower);
//upper range...
AbstractIntermediate u = igc.getFalseTarget(line);
NullIntermediate nullIntermediate = new NullIntermediate(u.getInstruction().getPrev());
AbstractIntermediate ai = igc.getOrderedIntermediate().floor(nullIntermediate);
if (ai != null) {
line.getBlockRange().setEnd(ai.getInstruction());
}
}
Aggregations