ASTTryStatement.java
01 /**
02  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03  */
04 package net.sourceforge.pmd.lang.ecmascript.ast;
05 
06 import org.mozilla.javascript.ast.TryStatement;
07 
08 public class ASTTryStatement extends AbstractEcmascriptNode<TryStatement> {
09     public ASTTryStatement(TryStatement tryStatement) {
10   super(tryStatement);
11     }
12 
13     /**
14      * Accept the visitor.
15      */
16     public Object jjtAccept(EcmascriptParserVisitor visitor, Object data) {
17   return visitor.visit(this, data);
18     }
19 
20     public EcmascriptNode getTryBlock() {
21   return (EcmascriptNodejjtGetChild(0);
22     }
23 
24     public boolean isCatch() {
25   return getNumCatchClause() != 0;
26     }
27 
28     public int getNumCatchClause() {
29   return node.getCatchClauses().size();
30     }
31 
32     public ASTCatchClause getCatchClause(int index) {
33   return (ASTCatchClausejjtGetChild(index - 1);
34     }
35 
36     public boolean isFinally() {
37   return node.getFinallyBlock() != null;
38     }
39 
40     public EcmascriptNode getFinallyBlock() {
41   return (EcmascriptNodejjtGetChild(jjtGetNumChildren() 1);
42     }
43 }