public final class NodeUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static JSDocInfo |
getFunctionJSDocInfo(Node n)
Get the JSDocInfo for a function.
|
static Node |
getFunctionParameters(Node fnNode) |
static InputId |
getInputId(Node n) |
static int |
getInverseOperator(int type)
Returns the inverse of an operator if it is invertible.
|
static String |
getNearestFunctionName(Node n)
Gets the function's name.
|
static Node |
getRootOfQualifiedName(Node qName)
Gets the root node of a qualified name.
|
static StaticSourceFile |
getSourceFile(Node n) |
static String |
getSourceName(Node n) |
static Collection<Node> |
getVarsDeclaredInBranch(Node root)
Retrieves vars declared in the current node tree, excluding descent scopes.
|
static boolean |
isRelationalOperation(Node n)
Returns true if the operator on this node is relational.
|
static boolean |
isSymmetricOperation(Node n)
Returns true if the operator on this node is symmetric
|
static boolean |
isValidQualifiedName(String name)
Determines whether the given name is a valid qualified name.
|
static boolean |
isValidSimpleName(String name)
Determines whether the given name is a valid variable name.
|
static Node |
newExpr(Node child)
Creates an EXPR_RESULT.
|
static Node |
newQualifiedNameNode(CodingConvention convention,
String name)
Creates a node representing a qualified name.
|
public static String getNearestFunctionName(Node n)
{'name': function() ...}{name: function() ...}function name() ...var name = function() ...qualified.name = function() ...var name2 = function name1() ...qualified.name2 = function name1() ...n - a node whose type is Token.FUNCTIONnull if it has no namepublic static boolean isSymmetricOperation(Node n)
public static boolean isRelationalOperation(Node n)
public static int getInverseOperator(int type)
public static Node newExpr(Node child)
child - The expression itself.public static Node newQualifiedNameNode(CodingConvention convention, String name)
name - A qualified name (e.g. "foo" or "foo.bar.baz")public static Node getRootOfQualifiedName(Node qName)
public static boolean isValidSimpleName(String name)
public static boolean isValidQualifiedName(String name)
public static Collection<Node> getVarsDeclaredInBranch(Node root)
public static Node getFunctionParameters(Node fnNode)
fnNode - The function.public static JSDocInfo getFunctionJSDocInfo(Node n)
public static String getSourceName(Node n)
n - The node.public static StaticSourceFile getSourceFile(Node n)
n - The node.