Class ThrowNode

All Implemented Interfaces:
Terminal, Cloneable

public final class ThrowNode extends Statement
IR representation for throw statements.
  • Constructor Details

    • ThrowNode

      public ThrowNode(int lineNumber, long token, int finish, Expression expression, boolean isSyntheticRethrow)
      Constructor
      Parameters:
      lineNumber - line number
      token - token
      finish - finish
      expression - expression to throw
      isSyntheticRethrow - true if this throw node is part of a synthetic rethrow.
  • Method Details

    • 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
    • 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
    • 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?
    • getExpression

      public Expression getExpression()
      Get the expression that is being thrown by this node
      Returns:
      expression
    • setExpression

      public ThrowNode setExpression(Expression expression)
      Reset the expression being thrown by this node
      Parameters:
      expression - new expression
      Returns:
      new or same thrownode
    • isSyntheticRethrow

      public boolean isSyntheticRethrow()
      Is this a throw a synthetic rethrow in a synthetic catch-all block created when inlining finally statements? In that case we never wrap whatever is thrown into an ECMAException, just rethrow it.
      Returns:
      true if synthetic throw node
    • isCompletionValueNeverEmpty

      public boolean isCompletionValueNeverEmpty()
      Overrides:
      isCompletionValueNeverEmpty in class Statement
      Returns:
      true if the completion value of this statement is never the value empty