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
AbstractVar
subclass 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 ifTypedVar
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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
java.lang.String
getInputName()
JSType
getType()
Gets this variable's type.int
hashCode()
boolean
isTypeInferred()
Returns whether this variable's type is inferred.java.lang.String
toString()
-
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:
getType
in interfaceStaticTypedSlot
- 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, seegetType()
.- Specified by:
isTypeInferred
in interfaceStaticTypedSlot
-
getInputName
public java.lang.String getInputName()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-