use of edu.rice.cs.caper.bayou.core.dsl.DExcept in project bayou by capergroup.
the class DOMTryStatement method handle.
@Override
public DSubTree handle() {
DSubTree tree = new DSubTree();
// restriction: considering only the first catch clause
DSubTree Ttry = new DOMBlock(statement.getBody(), visitor).handle();
DSubTree Tcatch;
if (!statement.catchClauses().isEmpty())
Tcatch = new DOMCatchClause((CatchClause) statement.catchClauses().get(0), visitor).handle();
else
Tcatch = new DSubTree();
DSubTree Tfinally = new DOMBlock(statement.getFinally(), visitor).handle();
boolean except = Ttry.isValid() && Tcatch.isValid();
if (except)
tree.addNode(new DExcept(Ttry.getNodes(), Tcatch.getNodes()));
else {
// only one of these will add nodes
tree.addNodes(Ttry.getNodes());
tree.addNodes(Tcatch.getNodes());
}
tree.addNodes(Tfinally.getNodes());
return tree;
}
Aggregations