Class FunctionCall

  • All Implemented Interfaces:
    java.lang.Comparable<AstNode>, java.lang.Iterable<Node>
    Direct Known Subclasses:
    NewExpression

    public class FunctionCall
    extends AstNode
    AST node for a function call. Node type is Token.CALL.

    • Constructor Detail

      • FunctionCall

        public FunctionCall()
      • FunctionCall

        public FunctionCall​(int pos)
      • FunctionCall

        public FunctionCall​(int pos,
                            int len)
    • Method Detail

      • getTarget

        public AstNode getTarget()
        Returns node evaluating to the function to call
      • setTarget

        public void setTarget​(AstNode target)
        Sets node evaluating to the function to call, and sets its parent to this node.
        Parameters:
        target - node evaluating to the function to call.
        Throws:
        java.lang.IllegalArgumentException - } if target is null
      • getArguments

        public java.util.List<AstNode> getArguments()
        Returns function argument list
        Returns:
        function argument list, or an empty immutable list if there are no arguments.
      • setArguments

        public void setArguments​(java.util.List<AstNode> arguments)
        Sets function argument list
        Parameters:
        arguments - function argument list. Can be null, in which case any existing args are removed.
      • addArgument

        public void addArgument​(AstNode arg)
        Adds an argument to the list, and sets its parent to this node.
        Parameters:
        arg - the argument node to add to the list
        Throws:
        java.lang.IllegalArgumentException - } if arg is null
      • getLp

        public int getLp()
        Returns left paren position, -1 if missing
      • setLp

        public void setLp​(int lp)
        Sets left paren position
        Parameters:
        lp - left paren position
      • getRp

        public int getRp()
        Returns right paren position, -1 if missing
      • setRp

        public void setRp​(int rp)
        Sets right paren position
      • setParens

        public void setParens​(int lp,
                              int rp)
        Sets both paren positions
      • toSource

        public java.lang.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.

        Specified by:
        toSource in class AstNode
        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 object, and the arguments.
        Specified by:
        visit in class AstNode
        Parameters:
        v - the object to call with this node and its children