ASTNewExpression.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.NewExpression;
07 
08 public class ASTNewExpression extends AbstractEcmascriptNode<NewExpression> {
09     public ASTNewExpression(NewExpression newExpression) {
10   super(newExpression);
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 getTarget() {
21   return (EcmascriptNodejjtGetChild(0);
22     }
23 
24     public int getNumArguments() {
25   return node.getArguments().size();
26     }
27 
28     public EcmascriptNode getArgument(int index) {
29   return (EcmascriptNodejjtGetChild(index + 1);
30     }
31 
32     public boolean hasArguments() {
33   return getNumArguments() != 0;
34     }
35 
36     public boolean hasInitializer() {
37   return node.getInitializer() != null;
38     }
39 
40     public ASTObjectLiteral getInitializer() {
41   return (ASTObjectLiteraljjtGetChild(jjtGetNumChildren() 1);
42     }
43 }