Package com.google.javascript.jscomp
Class TypedVar
- All Implemented Interfaces:
StaticTypedRef,StaticTypedSlot,StaticRef,StaticSlot,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:
-
Method Summary
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, isThisMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.javascript.rhino.StaticRef
getNode, getSourceFileMethods inherited from interface com.google.javascript.rhino.StaticSlot
getJSDocInfo, getNameMethods inherited from interface com.google.javascript.rhino.jstype.StaticTypedRef
getSymbolMethods inherited from interface com.google.javascript.rhino.jstype.StaticTypedSlot
getDeclaration, getScope
-
Method Details
-
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
-
toString
-
equals
-
hashCode
public final int hashCode()
-