Class Reference

  • All Implemented Interfaces:
    StaticRef, java.io.Serializable

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

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.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()
      • 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.