Class TypedVar

  • All Implemented Interfaces:
    StaticTypedRef, StaticTypedSlot, StaticRef, StaticSlot, java.io.Serializable

    public class TypedVar
    extends AbstractVar<TypedScope,​TypedVar>
    implements StaticTypedSlot, StaticTypedRef
    AbstractVar subclass for use with TypedScope.

    Note that this class inherits its Object.equals(java.lang.Object) and Object.hashCode() implementations from ScopedName, which does not include any type information. This is necessary because Var-keyed maps are used across multiple top scopes, but it comes with the caveat that if TypedVar instances are stored in a set, the type information is at risk of disappearing if an untyped (or differently typed) var is added for the same symbol.

    See Also:
    Serialized Form
    • Method Detail

      • getType

        public JSType getType()
        Gets this variable's type. To know whether this type has been inferred, see #isTypeInferred().
        Specified by:
        getType in interface StaticTypedSlot
        Returns:
        The type or null if no type is declared for it.
      • isTypeInferred

        public boolean isTypeInferred()
        Returns whether this variable's type is inferred. To get the variable's type, see getType().
        Specified by:
        isTypeInferred in interface StaticTypedSlot
      • getInputName

        public java.lang.String getInputName()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object