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.
  • Field Details

    • IMPLICITLY_NULLABLE_JSDOC

      public static final DiagnosticType IMPLICITLY_NULLABLE_JSDOC
    • IMPLICITLY_NONNULL_JSDOC

      public static final DiagnosticType IMPLICITLY_NONNULL_JSDOC
  • Constructor Details

    • ImplicitNullabilityCheck

      public ImplicitNullabilityCheck(AbstractCompiler compiler)
  • Method Details

    • process

      public void process(Node externs, Node root)
      Description copied from interface: CompilerPass
      Process the JS with root node root. Can modify the contents of each Node tree
      Specified by:
      process in interface CompilerPass
      Parameters:
      externs - Top of external JS tree
      root - 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

      public 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.
      Specified by:
      visit in interface NodeTraversal.Callback
      Parameters:
      t - The current traversal.
      n - The current node.
      p - The parent of the current node.