public final class NodeUtil extends Object
Modifier and Type | Method and Description |
---|---|
static JSDocInfo |
getBestJSDocInfo(Node n)
Find the best JSDoc for the given node.
|
static JSDocInfo |
getFunctionJSDocInfo(Node n)
Get the JSDocInfo for a function.
|
static Node |
getFunctionParameters(Node fnNode) |
static InputId |
getInputId(Node n) |
static String |
getNearestFunctionName(Node n)
Gets the function's name.
|
static StaticSourceFile |
getSourceFile(Node n) |
static String |
getSourceName(Node n) |
static boolean |
isLValue(Node n)
Determines whether this node is used as an L-value.
|
static TernaryValue |
isStrWhiteSpaceChar(int c)
Copied from Rhino's ScriptRuntime
|
static boolean |
isValidQualifiedName(String name)
Determines whether the given name is a valid qualified name.
|
static Map<Node,Node> |
mapMainToClone(Node main,
Node clone)
Given an AST and its copy, map the root node of each scope of main to the
corresponding root node of clone
|
static Node |
newQualifiedNameNode(CodingConvention convention,
String name)
Creates a node representing a qualified name.
|
static Node |
newQualifiedNameNodeDeclaration(CodingConvention convention,
String name,
Node value,
JSDocInfo info)
Creates a node representing a qualified name.
|
static void |
verifyScopeChanges(Map<Node,Node> map,
Node main,
boolean verifyUnchangedNodes,
AbstractCompiler compiler)
Checks that the scope roots marked as changed have indeed changed
|
public static TernaryValue isStrWhiteSpaceChar(int c)
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.FUNCTION
null
if it has no namepublic static boolean isLValue(Node n)
n
- The nodepublic static Node newQualifiedNameNode(CodingConvention convention, String name)
name
- A qualified name (e.g. "foo" or "foo.bar.baz")public static Node newQualifiedNameNodeDeclaration(CodingConvention convention, String name, Node value, JSDocInfo info)
name
- A qualified name (e.g. "foo" or "foo.bar.baz")public static boolean isValidQualifiedName(String name)
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.public static InputId getInputId(Node n)
n
- The node.public static JSDocInfo getBestJSDocInfo(Node n)
public static Map<Node,Node> mapMainToClone(Node main, Node clone)
public static void verifyScopeChanges(Map<Node,Node> map, Node main, boolean verifyUnchangedNodes, AbstractCompiler compiler)
Copyright © 2009-2014 Google. All Rights Reserved.