Class Reference

java.lang.Object
com.google.javascript.jscomp.Reference
All Implemented Interfaces:
StaticRef, Serializable

public final class Reference extends Object implements StaticRef, Serializable
Represents a single declaration or reference to a variable. Note that references can only be used with untyped scopes and traversals.
See Also:
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSymbol

      public Var getSymbol()
      Description copied from interface: StaticRef
      The variable that this reference points to.
      Specified by:
      getSymbol in interface StaticRef
    • getNode

      public Node getNode()
      Description copied from interface: StaticRef
      The node where the reference lives.
      Specified by:
      getNode in interface StaticRef
    • getInputId

      public InputId getInputId()
    • getSourceFile

      public StaticSourceFile getSourceFile()
      Description copied from interface: StaticRef
      The source file where the reference lives.
      Specified by:
      getSourceFile in interface StaticRef
    • isVarDeclaration

      public boolean isVarDeclaration()
    • isConstDeclaration

      public boolean isConstDeclaration()
    • isInitializingDeclaration

      public boolean isInitializingDeclaration()
      Determines whether the variable is initialized at the declaration.
    • isSimpleAssignmentToName

      public boolean isSimpleAssignmentToName()
    • isLvalue

      public boolean isLvalue()
      Returns whether the name node for this reference is an lvalue. TODO(tbreisacher): This method disagrees with NodeUtil#isLValue for "var x;" and "let x;". Consider updating it to match.