Class BaseNode

All Implemented Interfaces:
FunctionCall, Cloneable
Direct Known Subclasses:
AccessNode, IndexNode

public abstract class BaseNode extends OptionalExpression implements FunctionCall
IR base for accessing/indexing nodes.
See Also:
  • Field Details

    • base

      protected final Expression base
      Base Node.
  • Constructor Details

    • BaseNode

      public BaseNode(long token, int finish, Expression base, boolean isSuper, boolean optional, boolean optionalChain)
      Constructor
      Parameters:
      token - token
      finish - finish
      base - base node
      isSuper - is this a super property access
    • BaseNode

      protected BaseNode(BaseNode baseNode, Expression base, boolean isSuper, boolean optional, boolean optionalChain)
      Copy constructor for immutable nodes
      Parameters:
      baseNode - node to inherit from
      base - base
      isSuper - is this a super property access
  • Method Details

    • getBase

      public Expression getBase()
      Get the base node for this access
      Returns:
      the base node
    • isFunction

      public boolean isFunction()
      Description copied from interface: FunctionCall
      Returns true if the value of this expression will be treated as a function and immediately invoked.
      Specified by:
      isFunction in interface FunctionCall
    • isSuper

      public boolean isSuper()
      Returns:
      true if this is a super property access.
    • isIndex

      public boolean isIndex()
      Return true if this node represents an index operation normally represented as IndexNode.
      Returns:
      true if an index access.
    • setIsSuper

      public abstract BaseNode setIsSuper()
      Mark this node as being a SuperProperty access.
    • isOptional

      public final boolean isOptional()
      Returns true if this is an optional property access (a?.b or a?.[b]).
      Specified by:
      isOptional in class OptionalExpression
    • isOptionalChain

      public final boolean isOptionalChain()
      Description copied from class: OptionalExpression
      Returns true if this part of an optional chain.
      Specified by:
      isOptionalChain in class OptionalExpression