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 TypeMethodDescriptionboolean
Gets 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.int
hashCode()
boolean
Whether this is a bleeding function (an anonymous named function that bleeds into the inner scope).boolean
isConst()
Returnstrue
if the variable is declared as a constant, based on the value reported byNodeUtil
.boolean
isDefine()
Returnstrue
if the variable is declared as a define.boolean
isGlobal()
Returns whether this is a global variable.boolean
isLocal()
Returns whether this is a local variable.boolean
boolean
Returns whether this variable's type is inferred.toString()
-
Method Details
-
getName
Gets the name of the variable.- Specified by:
getName
in interfaceStaticSlot<JSType>
-
getNode
Gets the node for the name of the variable.- Specified by:
getNode
in interfaceStaticReference<JSType>
-
getSourceFile
Description copied from interface:StaticReference
The source file where the reference lives.- Specified by:
getSourceFile
in interfaceStaticReference<JSType>
-
getSymbol
Description copied from interface:StaticReference
The variable that this reference points to.- Specified by:
getSymbol
in interfaceStaticReference<JSType>
-
getDeclaration
Description copied from interface:StaticSlot
Gets the declaration of this symbol. May not exist.- Specified by:
getDeclaration
in 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()Returnstrue
if the variable is declared as a constant, based on the value reported byNodeUtil
. -
isDefine
public boolean isDefine()Returnstrue
if 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:
getType
in interfaceStaticSlot<JSType>
- Returns:
- The type or
null
if no type is declared for it.
-
getNameNode
Returns the name node that produced this variable. -
getJSDocInfo
Gets the JSDocInfo for the variable.- Specified by:
getJSDocInfo
in interfaceStaticSlot<JSType>
-
isTypeInferred
public boolean isTypeInferred()Returns whether this variable's type is inferred. To get the variable's type, seegetType()
.- Specified by:
isTypeInferred
in interfaceStaticSlot<JSType>
-
getInputName
-
isNoShadow
public boolean isNoShadow() -
equals
-
hashCode
public int hashCode() -
toString
-