public void visit(TryStatement tryStmt)
{
println("try {");
visit_(tryStmt.getTryBlock());
indent("} ");
Block clauses= tryStmt.getCatchStatements();
CatchClause clause= (CatchClause) clauses.getFirstChild();
String ex= null;
if (clause != null)
{
ex= clause.getException().getName();
}
// if (clauses.getChildCount() == 1)
// {
// print("catch(" + ex + ") ");
// clause.visit(this);
// }
if (clauses.getChildCount() > 0)
{
println("catch(" + ex + ") {");
depth++;
indent();
while (clause != null)
{
if (clause.getException().getType() != null)
print("if (dragomeJs.isInstanceof(" + ex + ", " + normalizeExpression(Utils.getSignature(clause.getException().getType())) + ")) ");
else
print("if (true)");
clause.visit(this);
clause= (CatchClause) clause.getNextSibling();
if (clause == null)
break;
print(" else ");
}
print(" else throw dragomeJs.nullSaveException(" + ex + "); ");
println("");
depth--;
indent("}");
}
Block finallyBlock= tryStmt.getFinallyBlock();
if (finallyBlock != null)
{
println(" finally {");
visit_(finallyBlock);
indent("}");