Package com.google.javascript.jscomp
Class Scope.Var
java.lang.Object
com.google.javascript.jscomp.Scope.Var
- All Implemented Interfaces:
StaticReference<JSType>,StaticSlot<JSType>
- Direct Known Subclasses:
Scope.Arguments
- Enclosing class:
- Scope
Stores info about a variable
-
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the declaration of this symbol.Gets the JSDocInfo for the variable.getName()Gets the name of the variable.Returns the name node that produced this variable.getNode()Gets the node for the name of the variable.Gets the parent of the name node.The source file where the reference lives.The variable that this reference points to.getType()Gets this variable's type.inthashCode()booleanWhether this is a bleeding function (an anonymous named function that bleeds into the inner scope).booleanisConst()Returnstrueif the variable is declared as a constant, based on the value reported byNodeUtil.booleanisDefine()Returnstrueif the variable is declared as a define.booleanisGlobal()Returns whether this is a global variable.booleanisLocal()Returns whether this is a local variable.booleanbooleanReturns whether this variable's type is inferred.toString()
-
Method Details
-
getName
Gets the name of the variable.- Specified by:
getNamein interfaceStaticSlot<JSType>
-
getNode
Gets the node for the name of the variable.- Specified by:
getNodein interfaceStaticReference<JSType>
-
getSourceFile
Description copied from interface:StaticReferenceThe source file where the reference lives.- Specified by:
getSourceFilein interfaceStaticReference<JSType>
-
getSymbol
Description copied from interface:StaticReferenceThe variable that this reference points to.- Specified by:
getSymbolin interfaceStaticReference<JSType>
-
getDeclaration
Description copied from interface:StaticSlotGets the declaration of this symbol. May not exist.- Specified by:
getDeclarationin interfaceStaticSlot<JSType>
-
getParentNode
Gets the parent of the name node. -
isBleedingFunction
public boolean isBleedingFunction()Whether this is a bleeding function (an anonymous named function that bleeds into the inner scope). -
isGlobal
public boolean isGlobal()Returns whether this is a global variable. -
isLocal
public boolean isLocal()Returns whether this is a local variable. -
isConst
public boolean isConst()Returnstrueif the variable is declared as a constant, based on the value reported byNodeUtil. -
isDefine
public boolean isDefine()Returnstrueif the variable is declared as a define. A variable is a define if it is annotated by@define. -
getInitialValue
-
getType
Gets this variable's type. To know whether this type has been inferred, see#isTypeInferred().- Specified by:
getTypein interfaceStaticSlot<JSType>- Returns:
- The type or
nullif no type is declared for it.
-
getNameNode
Returns the name node that produced this variable. -
getJSDocInfo
Gets the JSDocInfo for the variable.- Specified by:
getJSDocInfoin interfaceStaticSlot<JSType>
-
isTypeInferred
public boolean isTypeInferred()Returns whether this variable's type is inferred. To get the variable's type, seegetType().- Specified by:
isTypeInferredin interfaceStaticSlot<JSType>
-
getInputName
-
isNoShadow
public boolean isNoShadow() -
equals
-
hashCode
public int hashCode() -
toString
-