Package com.google.javascript.jscomp
Class TypedVar
- java.lang.Object
-
- com.google.javascript.jscomp.AbstractVar<TypedScope,TypedVar>
-
- com.google.javascript.jscomp.TypedVar
-
- All Implemented Interfaces:
StaticTypedRef,StaticTypedSlot,StaticRef,StaticSlot,java.io.Serializable
public class TypedVar extends AbstractVar<TypedScope,TypedVar> implements StaticTypedSlot, StaticTypedRef
AbstractVarsubclass for use withTypedScope.Note that this class inherits its
Object.equals(java.lang.Object)andObject.hashCode()implementations fromScopedName, which does not include any type information. This is necessary becauseVar-keyed maps are used across multiple top scopes, but it comes with the caveat that ifTypedVarinstances 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)java.lang.StringgetInputName()JSTypegetType()Gets this variable's type.inthashCode()booleanisTypeInferred()Returns whether this variable's type is inferred.java.lang.StringtoString()-
Methods inherited from class com.google.javascript.jscomp.AbstractVar
getDeclaration, getInitialValue, getJSDocInfo, getName, getNameNode, getNode, getParentNode, getScope, getScopeRoot, getSourceFile, getSymbol, isArguments, isBleedingFunction, isDeclaredOrInferredConst, isDefaultParam, isDefine, isGlobal, isLocal, isThis
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.javascript.rhino.StaticRef
getNode, getSourceFile
-
Methods inherited from interface com.google.javascript.rhino.StaticSlot
getJSDocInfo, getName
-
Methods inherited from interface com.google.javascript.rhino.jstype.StaticTypedRef
getSymbol
-
Methods inherited from interface com.google.javascript.rhino.jstype.StaticTypedSlot
getDeclaration, getScope
-
-
-
-
Method Detail
-
getType
public JSType getType()
Gets this variable's type. To know whether this type has been inferred, see#isTypeInferred().- Specified by:
getTypein interfaceStaticTypedSlot- Returns:
- The type or
nullif no type is declared for it.
-
isTypeInferred
public boolean isTypeInferred()
Returns whether this variable's type is inferred. To get the variable's type, seegetType().- Specified by:
isTypeInferredin interfaceStaticTypedSlot
-
getInputName
public java.lang.String getInputName()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-