Class PropertyGet

All Implemented Interfaces:
Comparable<AstNode>, Iterable<Node>

public class PropertyGet extends InfixExpression
AST node for the '.' operator. Node type is Token.GETPROP.
  • Constructor Details

    • PropertyGet

      public PropertyGet()
    • PropertyGet

      public PropertyGet(int pos)
    • PropertyGet

      public PropertyGet(int pos, int len)
    • PropertyGet

      public PropertyGet(int pos, int len, AstNode target, Name property)
    • PropertyGet

      public PropertyGet(AstNode target, Name property)
      Constructor. Updates bounds to include left (target) and right (property) nodes.
    • PropertyGet

      public PropertyGet(AstNode target, Name property, int dotPosition)
  • Method Details

    • getTarget

      public AstNode getTarget()
      Returns the object on which the property is being fetched. Should never be null.
    • setTarget

      public void setTarget(AstNode target)
      Sets target object, and sets its parent to this node.
      Parameters:
      target - expression evaluating to the object upon which to do the property lookup
      Throws:
      IllegalArgumentException - } if target is null
    • getProperty

      public Name getProperty()
      Returns the property being accessed.
    • setProperty

      public void setProperty(Name property)
      Sets the property being accessed, and sets its parent to this node.
      Throws:
      IllegalArgumentException - } if property is null
    • toSource

      public String toSource(int depth)
      Description copied from class: AstNode
      Emits source code for this node. Callee is responsible for calling this function recursively on children, incrementing indent as appropriate.

      Note: if the parser was in error-recovery mode, some AST nodes may have null children that are expected to be non-null when no errors are present. In this situation, the behavior of the toSource method is undefined: toSource implementations may assume that the AST node is error-free, since it is intended to be invoked only at runtime after a successful parse.

      Overrides:
      toSource in class InfixExpression
      Parameters:
      depth - the current recursion depth, typically beginning at 0 when called on the root node.
    • visit

      public void visit(NodeVisitor v)
      Visits this node, the target expression, and the property name.
      Overrides:
      visit in class InfixExpression
      Parameters:
      v - the object to call with this node and its children