if (stmt instanceof JumpSubRoutine)
{
JumpSubRoutine jsr= (JumpSubRoutine) stmt;
cNode.block.setEndIndex(jsr.getEndIndex());
Node finallyNode= graph.getNode(jsr.getTargetIndex());
if (finallyNode == null)
{
finallyNode= graph.createNode(jsr.getTargetIndex());
finallyNode.stack= new ASTNodeStack(new Expression());
}
finallyNode.jsrCallers.add(cNode);
if (cNode.preds().size() == 1 && finallyNode.preds().size() == 0 && cNode.getPred() instanceof TryHeaderNode)
{
TryHeaderNode tryHeaderNode= (TryHeaderNode) cNode.getPred();
tryHeaderNode.setFinallyNode(finallyNode);
}
}
else if (stmt instanceof ConditionalBranch)
{
ConditionalBranch cond= (ConditionalBranch) stmt;
if (bytes.getIndex() == cond.getTargetIndex())
{
}
else
{
Node elseNode= graph.getOrCreateNode(bytes.getIndex());
Node ifNode;
if (cond.getTargetIndex() <= pc)
{
Node[] nodes= graph.getOrSplitNodeAt(cNode, cond.getTargetIndex());
cNode= nodes[0];
ifNode= nodes[1];
}
else
{
ifNode= graph.getOrCreateNode(cond.getTargetIndex());
}
BooleanExpression be= new BooleanExpression(cond.getExpression());
graph.addIfElseEdge(cNode, ifNode, elseNode, be);
expressionsToVariables(cNode, false);
cNode= null;
if (lastJump != null && tryStatements.size() > 0 && (cond.getBeginIndex() - 1 == lastJump.getEndIndex()))
whileTryProblemDetected= true;
for (TryStatement tryStatement : tryStatements)
{
boolean nextToTryBegining= tryStatement.getBeginIndex() - 1 == cond.getEndIndex();
boolean sameThanTryBegining= tryStatement.getBeginIndex() == cond.getBeginIndex();
// sameThanTryBegining= false; //TODO identificar si es un while!
if (nextToTryBegining || sameThanTryBegining)
whileTryProblemDetected= true;
}
if (!whileTryProblemDetected)
for (CodeException codeException : code.getExceptionTable())
{
boolean nextToTryBegining= codeException.getEndPC() == cond.getTargetIndex();
if (nextToTryBegining)
whileTryProblemDetected= true;
}
if (whileTryProblemDetected)
throw new UnhandledCompilerProblemException();
}
}
else if (stmt instanceof Jump)
{
int targetPc= ((Jump) stmt).getTargetIndex();
lastJump= (Jump) stmt;
Node targetNode;
if (!whileTryProblemDetected)
for (CodeException codeException : code.getExceptionTable())
{
boolean nextToTryBegining= codeException.getStartPC() - 1 == lastJump.getEndIndex();