Class CallNode

All Implemented Interfaces:
Cloneable

public final class CallNode extends OptionalExpression
IR representation for a function call.
  • Method Details

    • forNew

      public static Expression forNew(int lineNumber, long token, int start, int finish, Expression function, List<Expression> args)
    • forCall

      public static Expression forCall(int lineNumber, long token, int start, int finish, Expression function, List<Expression> args)
    • forCall

      public static Expression forCall(int lineNumber, long token, int start, int finish, Expression function, List<Expression> args, boolean optional, boolean optionalChain)
    • forCall

      public static Expression forCall(int lineNumber, long token, int start, int finish, Expression function, List<Expression> args, boolean optional, boolean optionalChain, boolean isEval, boolean isApplyArguments, boolean isDefaultDerivedConstructorSuperCall)
    • forTaggedTemplateLiteral

      public static Expression forTaggedTemplateLiteral(int lineNumber, long token, int start, int finish, Expression function, List<Expression> args)
    • forImport

      public static Expression forImport(int lineNumber, long token, int start, int finish, IdentNode importIdent, List<Expression> args, Module.ImportPhase phase)
    • getLineNumber

      public int getLineNumber()
      Returns the line number.
      Returns:
      the line number.
    • accept

      public Node accept(NodeVisitor<? extends LexicalContext> visitor)
      Assist in IR navigation.
      Specified by:
      accept in class Node
      Parameters:
      visitor - IR navigating visitor.
      Returns:
      node or replacement
    • 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?
    • getArgs

      public List<Expression> getArgs()
      Get the arguments for the call
      Returns:
      a list of arguments
    • setArgs

      public CallNode setArgs(List<Expression> args)
      Reset the arguments for the call
      Parameters:
      args - new arguments list
      Returns:
      new callnode, or same if unchanged
    • isEval

      public boolean isEval()
      Check if this call is a call to eval
      Returns:
      true if this is a call to eval
    • getFunction

      public Expression getFunction()
      Return the function expression that this call invokes
      Returns:
      the function
    • setFunction

      public CallNode setFunction(Expression function)
      Reset the function expression that this call invokes
      Parameters:
      function - the function
      Returns:
      same node or new one on state change
    • isNew

      public boolean isNew()
      Check if this call is a new operation
      Returns:
      true if this a new operation
    • isImport

      public boolean isImport()
      Check if this call is a dynamic import call.
    • isImportSource

      public boolean isImportSource()
      Check if this call is a dynamic import.source call.
    • isImportDefer

      public boolean isImportDefer()
      Check if this call is a dynamic import.defer call.
    • isApplyArguments

      public boolean isApplyArguments()
      Check if this call is an apply call.
    • isOptional

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

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

      public boolean isTaggedTemplateLiteral()
      Check if this is a tagged template literal call.
    • isDefaultDerivedConstructorSuperCall

      public boolean isDefaultDerivedConstructorSuperCall()