@GwtIncompatible(value="java.util.regex") class CheckMissingGetCssName extends NodeTraversal.AbstractPostOrderCallback implements CompilerPass
Modifier and Type | Field and Description |
---|---|
private Matcher |
blacklist |
private AbstractCompiler |
compiler |
(package private) static java.lang.String |
GET_CSS_NAME_FUNCTION |
(package private) static java.lang.String |
GET_UNIQUE_ID_FUNCTION |
private CheckLevel |
level |
(package private) static DiagnosticType |
MISSING_GETCSSNAME |
Constructor and Description |
---|
CheckMissingGetCssName(AbstractCompiler compiler,
CheckLevel level,
java.lang.String blacklistRegex) |
Modifier and Type | Method and Description |
---|---|
private boolean |
insideAssignmentToIdConstant(Node n)
Returns whether the node is the right hand side of an assignment or
initialization of a variable named *_ID of *_ID_.
|
private static boolean |
insideGetCssNameCall(Node n)
Returns whether the node is an argument of a goog.getCssName call.
|
private static boolean |
insideGetUniqueIdCall(Node n)
Returns whether the node is an argument of a function that returns
a unique id (the last part of the qualified name matches
GET_UNIQUE_ID_FUNCTION).
|
private static boolean |
isIdName(java.lang.String name) |
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
void |
visit(NodeTraversal t,
Node n,
Node parent)
Visits a node in postorder (after its children have been visited).
|
shouldTraverse
private final AbstractCompiler compiler
private final CheckLevel level
private final Matcher blacklist
static final java.lang.String GET_CSS_NAME_FUNCTION
static final java.lang.String GET_UNIQUE_ID_FUNCTION
static final DiagnosticType MISSING_GETCSSNAME
CheckMissingGetCssName(AbstractCompiler compiler, CheckLevel level, java.lang.String blacklistRegex)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treepublic void visit(NodeTraversal t, Node n, Node parent)
NodeTraversal.Callback
Visits a node in postorder (after its children have been visited).
A node is visited only if all its parents should be traversed
(NodeTraversal.Callback.shouldTraverse(NodeTraversal, Node, Node)
).
Implementations can have side effects (e.g. modifying the parse tree).
visit
in interface NodeTraversal.Callback
private static boolean insideGetCssNameCall(Node n)
private static boolean insideGetUniqueIdCall(Node n)
private boolean insideAssignmentToIdConstant(Node n)
private static boolean isIdName(java.lang.String name)