Class CatchNode

All Implemented Interfaces:
Terminal, Cloneable

public final class CatchNode extends Statement
IR representation of a catch clause.
  • Constructor Details

    • CatchNode

      public CatchNode(int lineNumber, long token, int finish, IdentNode exception, Expression pattern, Expression exceptionCondition, Block body, boolean isSyntheticRethrow)
      Constructors
      Parameters:
      lineNumber - lineNumber
      token - token
      finish - finish
      exception - variable name of exception
      pattern - catch parameter destructuring assignment
      exceptionCondition - exception condition
      body - catch body
      isSyntheticRethrow - true if this node is a synthetically generated rethrow node.
  • Method Details

    • 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 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
    • isTerminal

      public boolean isTerminal()
      Description copied from class: Statement
      Is this a terminal statement, i.e. does it end control flow like a throw or return?
      Specified by:
      isTerminal in interface Terminal
      Overrides:
      isTerminal in class Statement
      Returns:
      true if this node statement is terminal
    • toString

      public void toString(StringBuilder sb, boolean printTypes)
      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
      printTypes - print type?
    • getException

      public Expression getException()
      Get the identifier representing the exception thrown
      Returns:
      the exception identifier
    • getExceptionCondition

      public Expression getExceptionCondition()
      Get the exception condition for this catch block
      Returns:
      the exception condition
    • setExceptionCondition

      public CatchNode setExceptionCondition(Expression exceptionCondition)
      Reset the exception condition for this catch block
      Parameters:
      exceptionCondition - the new exception condition
      Returns:
      new or same CatchNode
    • getBody

      public Block getBody()
      Get the body for this catch block
      Returns:
      the catch block body
    • setException

      public CatchNode setException(IdentNode exception)
      Resets the exception of a catch block
      Parameters:
      exception - new exception
      Returns:
      new catch node if changed, same otherwise
    • getDestructuringPattern

      public Expression getDestructuringPattern()
      Get the exception destructuring pattern for this catch block
      Returns:
      the destructuring pattern
    • setDestructuringPattern

      public CatchNode setDestructuringPattern(Expression pattern)
      Resets the exception destructuring pattern of a catch block
      Parameters:
      pattern - new pattern
      Returns:
      new catch node if changed, same otherwise
    • isSyntheticRethrow

      public boolean isSyntheticRethrow()
      Is this catch block a non-JavaScript constructor, for example created as part of the rethrow mechanism of a finally block in Lower? Then we just pass the exception on and need not unwrap whatever is in the ECMAException object catch symbol
      Returns:
      true if a finally synthetic rethrow