use of org.candle.decompiler.intermediate.expression.Throw in project candle-decompiler by bradsdavis.
the class FinallyRangeVisitor method visitFinallyIntermediate.
@Override
public void visitFinallyIntermediate(FinallyIntermediate line) {
NonGotoIterator iter = new NonGotoIterator(igc.getGraph(), line);
// walk until we find a THROW.
AbstractIntermediate throwsStatement = null;
while (iter.hasNext()) {
AbstractIntermediate i = iter.next();
if (i instanceof StatementIntermediate) {
StatementIntermediate s = (StatementIntermediate) i;
if (s.getExpression() instanceof Throw) {
throwsStatement = s;
break;
}
}
}
if (throwsStatement != null) {
line.getBlockRange().setEnd(throwsStatement.getInstruction());
}
}
use of org.candle.decompiler.intermediate.expression.Throw in project candle-decompiler by bradsdavis.
the class MethodIntermediateVisitor method visitATHROW.
public void visitATHROW(ATHROW instruction) {
Expression expression = context.getExpressions().pop();
Throw throwException = new Throw(context.getCurrentInstruction(), expression);
StatementIntermediate complete = new StatementIntermediate(context.getCurrentInstruction(), throwException);
context.pushIntermediateToInstruction(complete);
}
use of org.candle.decompiler.intermediate.expression.Throw in project candle-decompiler by bradsdavis.
the class IntermediateGraphFactory method visitStatementIntermediate.
@Override
public void visitStatementIntermediate(StatementIntermediate line) {
AbstractIntermediate next = ilc.getNext(line);
// check to see if it is a return statement.
if (line.getExpression() instanceof Return) {
// don't add a line to next.
return;
}
if (line.getExpression() instanceof Throw) {
// don't add a line to next.
return;
}
if (next != null) {
// find how that actually maps to the abstract line..
AbstractIntermediate intermediate = next;
// now, we just add this into the graph.
igc.getGraph().addVertex(intermediate);
igc.getGraph().addEdge(line, intermediate);
}
}
use of org.candle.decompiler.intermediate.expression.Throw in project candle-decompiler by bradsdavis.
the class CatchUpperRangeVisitor method visitCatchIntermediate.
@Override
public void visitCatchIntermediate(CatchIntermediate line) {
// first, check if the line has an end already..
if (line.getBlockRange().getEnd() != null) {
return;
}
// processLastCatch(line);
BreadthFirstIterator<AbstractIntermediate, IntermediateEdge> bfi = new BreadthFirstIterator<AbstractIntermediate, IntermediateEdge>(igc.getGraph(), line);
AbstractIntermediate lastStatement = null;
while (bfi.hasNext()) {
AbstractIntermediate next = bfi.next();
if (next instanceof GoToIntermediate) {
// this would be a possible GOTO... find previous.
LOG.debug("Catch GOGO: " + next + " goto:" + next.getInstruction().getPosition());
lastStatement = igc.getSinglePredecessor(next);
break;
}
if (next instanceof StatementIntermediate) {
// determine what type of statement...
if (((StatementIntermediate) next).getExpression() instanceof Throw) {
lastStatement = next;
break;
}
if (((StatementIntermediate) next).getExpression() instanceof Return) {
lastStatement = next;
break;
}
}
}
if (lastStatement != null) {
line.getBlockRange().setEnd(lastStatement.getInstruction());
}
}
Aggregations