All Implemented Interfaces:
FromSourceLocation, ToNode, TypeCheck, ToCondition, ToExpression

public final class Reference extends Expression
A reference to a field.
  • Constructor Details

    • Reference

      public Reference(Identifier name, FromSourceLocation sourceLocation)
      Creates a Reference for the identifier from the given source location.
      Parameters:
      name - the identifier being referenced.
      sourceLocation - the source location for the reference.
  • Method Details

    • getName

      public Identifier getName()
      Gets the name of the field being referenced.
      Returns:
      the name of the referenced field.
    • template

      public String template()
      Description copied from class: SyntaxElement
      Converts this expression to a string template. By default, this implementation returns a RuntimeException.
      Overrides:
      template in class SyntaxElement
      Returns:
      the String template.
    • accept

      public <R> R accept(ExpressionVisitor<R> visitor)
      Description copied from class: Expression
      Invoke the ExpressionVisitor functions for this expression.
      Specified by:
      accept in class Expression
      Type Parameters:
      R - the visitor return type.
      Parameters:
      visitor - the visitor to be invoked.
      Returns:
      the return value of the visitor.
    • typeCheckLocal

      protected Type typeCheckLocal(Scope<Type> scope)
      Specified by:
      typeCheckLocal in class Expression
    • toNode

      public Node toNode()
      Description copied from interface: ToNode
      Converts a value to a Node.
      Returns:
      Returns the creates Node.
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in class Expression
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class Expression
    • toString

      public String toString()
      Overrides:
      toString in class Object