Class IndexNode

All Implemented Interfaces:
FunctionCall, Cloneable

public final class IndexNode extends BaseNode
IR representation of an indexed access (brackets operator.)
  • Constructor Details

    • IndexNode

      public IndexNode(long token, int finish, Expression base, Expression index, boolean isSuper, boolean optional, boolean optionalChain)
      Constructors
      Parameters:
      token - token
      finish - finish
      base - base node for access
      index - index for access
    • IndexNode

      public IndexNode(long token, int finish, Expression base, Expression index)
  • Method Details

    • accept

      public Node accept(NodeVisitor<? extends LexicalContext> visitor)
      Description copied from class: Node
      Provides a means to navigate the IR.
      Specified by:
      accept in class Node
      Parameters:
      visitor - Node visitor.
      Returns:
      node the node or its replacement after visitation, null if no further visitations are required
    • accept

      public <R> R accept(TranslatorNodeVisitor<? extends LexicalContext, R> visitor)
      Description copied from class: Node
      Provides a means to navigate the IR.
      Specified by:
      accept in class Node
      Parameters:
      visitor - Node visitor.
      Returns:
      node the node or its replacement after visitation, null if no further visitations are required
    • toString

      public void toString(StringBuilder sb, boolean printType)
      Description copied from class: Node
      Print logic that decides whether to show the optimistic type or not - for example it should not be printed after just parse, when it hasn't been computed, or has been set to a trivially provable value
      Specified by:
      toString in class Node
      Parameters:
      sb - string builder
      printType - print type?
    • getIndex

      public Expression getIndex()
      Get the index expression for this IndexNode
      Returns:
      the index
    • setIndex

      public IndexNode setIndex(Expression index)
      Set the index expression for this node
      Parameters:
      index - new index expression
      Returns:
      a node equivalent to this one except for the requested change.
    • setIsSuper

      public IndexNode setIsSuper()
      Description copied from class: BaseNode
      Mark this node as being a SuperProperty access.
      Specified by:
      setIsSuper in class BaseNode