Class JoinPredecessorExpression

java.lang.Object
com.oracle.js.parser.ir.Node
com.oracle.js.parser.ir.Expression
com.oracle.js.parser.ir.JoinPredecessorExpression
All Implemented Interfaces:
Cloneable

public class JoinPredecessorExpression extends Expression
A wrapper for an expression that is in a position to be a join predecessor.
  • Constructor Details

    • JoinPredecessorExpression

      public JoinPredecessorExpression()
      A no-arg constructor does not wrap any expression on its own, but can be used as a place to contain a local variable conversion in a place where an expression can otherwise stand.
    • JoinPredecessorExpression

      public JoinPredecessorExpression(Expression expression)
      A constructor for wrapping an expression and making it a join predecessor. Typically used on true and false subexpressions of the ternary node as well as on the operands of short-circuiting logical expressions && and ||.
      Parameters:
      expression - the expression to wrap
  • Method Details

    • isAlwaysFalse

      public boolean isAlwaysFalse()
      Description copied from class: Expression
      Returns true if the runtime value of this expression is always false when converted to boolean as per ECMAScript ToBoolean conversion. Used in control flow calculations.
      Overrides:
      isAlwaysFalse in class Expression
      Returns:
      true if this expression's runtime value converted to boolean is always false.
    • isAlwaysTrue

      public boolean isAlwaysTrue()
      Description copied from class: Expression
      Returns true if the runtime value of this expression is always true when converted to boolean as per ECMAScript ToBoolean conversion. Used in control flow calculations.
      Overrides:
      isAlwaysTrue in class Expression
      Returns:
      true if this expression's runtime value converted to boolean is always true.
    • getExpression

      public Expression getExpression()
      Returns the underlying expression.
      Returns:
      the underlying expression.
    • setExpression

      public JoinPredecessorExpression setExpression(Expression expression)
      Sets the underlying expression.
      Parameters:
      expression - the new underlying expression
      Returns:
      this or modified join predecessor expression object.
    • accept

      public Node accept(NodeVisitor<? extends LexicalContext> 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
    • 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?