View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.ecmascript.ast;
5   
6   import org.mozilla.javascript.ast.CatchClause;
7   
8   public class ASTCatchClause extends AbstractEcmascriptNode<CatchClause> {
9       public ASTCatchClause(CatchClause catchClause) {
10  	super(catchClause);
11      }
12  
13      /**
14       * Accept the visitor.
15       */
16      @Override
17      public Object jjtAccept(EcmascriptParserVisitor visitor, Object data) {
18  	return visitor.visit(this, data);
19      }
20  
21      public ASTName getVariableName() {
22  	return (ASTName) jjtGetChild(0);
23      }
24  
25      public boolean isIf() {
26  	return node.getCatchCondition() != null;
27      }
28  
29      public EcmascriptNode<?> getCatchCondition() {
30  	return (EcmascriptNode<?>) jjtGetChild(1);
31      }
32  
33      public ASTBlock getBlock() {
34  	return (ASTBlock) jjtGetChild(jjtGetNumChildren() - 1);
35      }
36  }