com.google.javascript.jscomp
Class Scope.Var

java.lang.Object
  extended by 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 Object
implements StaticSlot<JSType>, StaticReference<JSType>

Stores info about a variable


Method Summary
 boolean equals(Object other)
           
 Scope.Var getDeclaration()
          Gets the declaration of this symbol.
 Node getInitialValue()
           
 String getInputName()
           
 JSDocInfo getJSDocInfo()
          Gets the JSDocInfo for the variable.
 String getName()
          Gets the name of the variable.
 Node getNameNode()
          Returns the name node that produced this variable.
 Node getNode()
          Gets the node for the name of the variable.
 Node getParentNode()
          Gets the parent of the name node.
 StaticSourceFile getSourceFile()
          The source file where the reference lives.
 Scope.Var getSymbol()
          The variable that this reference points to.
 JSType getType()
          Gets this variable's type.
 int hashCode()
           
 boolean isBleedingFunction()
          Whether this is a bleeding function (an anonymous named function that bleeds into the inner scope.
 boolean isConst()
          Returns true if the variable is declared as a constant, based on the value reported by NodeUtil.
 boolean isDefine()
          Returns true 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 isNoShadow()
           
 boolean isTypeInferred()
          Returns whether this variable's type is inferred.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public String getName()
Gets the name of the variable.

Specified by:
getName in interface StaticSlot<JSType>

getNode

public Node getNode()
Gets the node for the name of the variable.

Specified by:
getNode in interface StaticReference<JSType>

getSourceFile

public StaticSourceFile getSourceFile()
Description copied from interface: StaticReference
The source file where the reference lives.

Specified by:
getSourceFile in interface StaticReference<JSType>

getSymbol

public Scope.Var getSymbol()
Description copied from interface: StaticReference
The variable that this reference points to.

Specified by:
getSymbol in interface StaticReference<JSType>

getDeclaration

public Scope.Var getDeclaration()
Description copied from interface: StaticSlot
Gets the declaration of this symbol. May not exist.

Specified by:
getDeclaration in interface StaticSlot<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()
Returns true if the variable is declared as a constant, based on the value reported by NodeUtil.


isDefine

public boolean isDefine()
Returns true if the variable is declared as a define. A variable is a define if it is annotaed 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:
getType in interface StaticSlot<JSType>
Returns:
The type or null if 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:
getJSDocInfo in interface StaticSlot<JSType>

isTypeInferred

public boolean isTypeInferred()
Returns whether this variable's type is inferred. To get the variable's type, see getType().

Specified by:
isTypeInferred in interface StaticSlot<JSType>

getInputName

public String getInputName()

isNoShadow

public boolean isNoShadow()

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object