Package com.google.javascript.jscomp
Class ImplicitNullabilityCheck
java.lang.Object
com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback
com.google.javascript.jscomp.ImplicitNullabilityCheck
- All Implemented Interfaces:
CompilerPass
,NodeTraversal.Callback
public final class ImplicitNullabilityCheck
extends NodeTraversal.AbstractPostOrderCallback
implements CompilerPass
Warn about types in JSDoc that are implicitly nullable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Represents the types of implicit nullability errors caught by this pass: a) implicitly nonnull (missing a "!"), and b) implicitly nullable (missing a "?").static class
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 "?"). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.collect.ImmutableList
<ImplicitNullabilityCheck.Result> 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 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.Methods inherited from class com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback
shouldTraverse
-
Field Details
-
IMPLICITLY_NULLABLE_JSDOC
-
IMPLICITLY_NONNULL_JSDOC
-
-
Constructor Details
-
ImplicitNullabilityCheck
-
-
Method Details
-
process
Description copied from interface:CompilerPass
Process the JS with root node root. Can modify the contents of each Node tree- Specified by:
process
in interfaceCompilerPass
- Parameters:
externs
- Top of external JS treeroot
- Top of JS tree
-
findImplicitNullabilityResults
public 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.) -
visit
Crawls the JSDoc of the given node to find any names in JSDoc that are implicitly null.- Specified by:
visit
in interfaceNodeTraversal.Callback
- Parameters:
t
- The current traversal.n
- The current node.p
- The parent of the current node.
-