com.google.javascript.jscomp
Class NodeUtil

java.lang.Object
  extended by com.google.javascript.jscomp.NodeUtil

public final class NodeUtil
extends Object

NodeUtil contains utilities that get properties from the Node object.


Method Summary
static Collection<Node> getVarsDeclaredInBranch(Node root)
          Retrieves vars declared in the current node tree, excluding descent scopes.
static Node newExpr(Node child)
          Creates an EXPR_RESULT.
static Node newFunctionNode(String name, List<Node> params, Node body, int lineno, int charno)
          Creates function name(params_0, ..., params_n) { body }.
static Node newQualifiedNameNode(CodingConvention convention, String name, int lineno, int charno)
          Creates a node representing a qualified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newExpr

public static Node newExpr(Node child)
Creates an EXPR_RESULT.

Parameters:
child - The expression itself.
Returns:
Newly created EXPR node with the child as subexpression.

newFunctionNode

public static Node newFunctionNode(String name,
                                   List<Node> params,
                                   Node body,
                                   int lineno,
                                   int charno)
Creates function name(params_0, ..., params_n) { body }.


newQualifiedNameNode

public static Node newQualifiedNameNode(CodingConvention convention,
                                        String name,
                                        int lineno,
                                        int charno)
Creates a node representing a qualified name.

Parameters:
name - A qualified name (e.g. "foo" or "foo.bar.baz")
lineno - The source line offset.
charno - The source character offset from start of the line.
Returns:
A NAME or GETPROP node

getVarsDeclaredInBranch

public static Collection<Node> getVarsDeclaredInBranch(Node root)
Retrieves vars declared in the current node tree, excluding descent scopes.