Class NoType

All Implemented Interfaces:
JSType.WithSourceRef

public class NoType extends NoObjectType
Bottom type, representing the subclass of any value or object. Although JavaScript programmers can't explicitly denote the bottom type, it comes up in static analysis. For example, if we have: var x = null; if (x) { f(x); } We need to be able to assign x a type within the f(x) call. Since it has no possible type, we assign x the NoType, so that f(x) is legal no matter what the type of f's first argument is.
See Also:
  • Method Details

    • isNoObjectType

      public final boolean isNoObjectType()
      Overrides:
      isNoObjectType in class NoObjectType
    • isNoType

      public boolean isNoType()
      Overrides:
      isNoType in class JSType
    • isNullable

      public final boolean isNullable()
      Description copied from class: JSType
      Tests whether this type is nullable.
      Overrides:
      isNullable in class JSType
    • isVoidable

      public final boolean isVoidable()
      Description copied from class: JSType
      Tests whether this type is voidable.
      Overrides:
      isVoidable in class JSType
    • getPossibleToBooleanOutcomes

      public final BooleanLiteralSet getPossibleToBooleanOutcomes()
      Description copied from class: JSType
      Computes the set of possible outcomes of the ToBoolean predicate for this type. The ToBoolean predicate is defined by the ECMA-262 standard, 3rd edition. Its behavior for simple types can be summarized by the following table:
      ToBoolean results by input type
      typeresult
      undefined{false}
      null{false}
      boolean{true, false}
      number{true, false}
      string{true, false}
      Object{true}
      Overrides:
      getPossibleToBooleanOutcomes in class ObjectType
      Returns:
      the set of boolean literals for this type
    • visit

      public final <T> T visit(Visitor<T> visitor)
      Description copied from class: JSType
      Visit this type with the given visitor.
      Overrides:
      visit in class NoObjectType
      Returns:
      the value returned by the visitor
      See Also: