public final class ImplicitNullabilityCheck extends NodeTraversal.AbstractPostOrderCallback implements CompilerPass
Modifier and Type | Class and Description |
---|---|
static class |
ImplicitNullabilityCheck.Nullability
Represents the types of implicit nullability errors caught by this pass: a) implicitly nonnull
(missing a "!"), and b) implicitly nullable (missing a "?").
|
static class |
ImplicitNullabilityCheck.Result
Information to represent a single "implicit nullability result", including the JSDoc string
node that needs a "!" or "?" to be explicit, as well as an enum indicating which of the two
nullability cases were found ("!" or "?").
|
Modifier and Type | Field and Description |
---|---|
static DiagnosticType |
IMPLICITLY_NONNULL_JSDOC |
static DiagnosticType |
IMPLICITLY_NULLABLE_JSDOC |
Constructor and Description |
---|
ImplicitNullabilityCheck(AbstractCompiler compiler) |
Modifier and Type | Method and Description |
---|---|
static com.google.common.collect.ImmutableList<ImplicitNullabilityCheck.Result> |
findImplicitNullabilityResults(JSDocInfo info,
NodeTraversal t)
Finds and returns all the JSDoc nodes inside the given JSDoc object whose nullability is not
explict, using the NodeTraversal the necessary state (current scope, etc.)
|
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
void |
visit(NodeTraversal t,
Node n,
Node p)
Crawls the JSDoc of the given node to find any names in JSDoc that are implicitly null.
|
shouldTraverse
public static final DiagnosticType IMPLICITLY_NULLABLE_JSDOC
public static final DiagnosticType IMPLICITLY_NONNULL_JSDOC
public ImplicitNullabilityCheck(AbstractCompiler compiler)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treepublic static com.google.common.collect.ImmutableList<ImplicitNullabilityCheck.Result> findImplicitNullabilityResults(JSDocInfo info, NodeTraversal t)
public void visit(NodeTraversal t, Node n, Node p)
visit
in interface NodeTraversal.Callback
t
- The current traversal.n
- The current node.p
- The parent of the current node.Copyright © 2009-2020 Google. All Rights Reserved.