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
public static class Scope.Var extends java.lang.Object implements StaticSlot<JSType>, StaticReference<JSType>
Stores info about a variable
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)Scope.VargetDeclaration()Gets the declaration of this symbol.NodegetInitialValue()java.lang.StringgetInputName()JSDocInfogetJSDocInfo()Gets the JSDocInfo for the variable.java.lang.StringgetName()Gets the name of the variable.NodegetNameNode()Returns the name node that produced this variable.NodegetNode()Gets the node for the name of the variable.NodegetParentNode()Gets the parent of the name node.StaticSourceFilegetSourceFile()The source file where the reference lives.Scope.VargetSymbol()The variable that this reference points to.JSTypegetType()Gets this variable's type.inthashCode()booleanisBleedingFunction()Whether 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.booleanisNoShadow()booleanisTypeInferred()Returns whether this variable's type is inferred.java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Gets the name of the variable.- Specified by:
getNamein interfaceStaticSlot<JSType>
-
getNode
public Node getNode()
Gets the node for the name of the variable.- Specified by:
getNodein interfaceStaticReference<JSType>
-
getSourceFile
public StaticSourceFile getSourceFile()
Description copied from interface:StaticReferenceThe source file where the reference lives.- Specified by:
getSourceFilein interfaceStaticReference<JSType>
-
getSymbol
public Scope.Var getSymbol()
Description copied from interface:StaticReferenceThe variable that this reference points to.- Specified by:
getSymbolin interfaceStaticReference<JSType>
-
getDeclaration
public Scope.Var getDeclaration()
Description copied from interface:StaticSlotGets the declaration of this symbol. May not exist.- Specified by:
getDeclarationin interfaceStaticSlot<JSType>
-
getParentNode
public Node 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
public Node getInitialValue()
-
getType
public JSType 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
public Node getNameNode()
Returns the name node that produced this variable.
-
getJSDocInfo
public JSDocInfo 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
public java.lang.String getInputName()
-
isNoShadow
public boolean isNoShadow()
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-