Class Nodes.IfNode

java.lang.Object
org.prism.Nodes.Node
org.prism.Nodes.IfNode
Enclosing class:
Nodes

public static final class Nodes.IfNode extends Nodes.Node
 Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression.

     bar if foo
     ^^^^^^^^^^

     if foo then bar end
     ^^^^^^^^^^^^^^^^^^^

     foo ? bar : baz
     ^^^^^^^^^^^^^^^
 
  • Field Details

    • predicate

      public final Nodes.Node predicate
       The node for the condition the `IfNode` is testing.
      
           if foo
              ^^^
             bar
           end
      
           bar if foo
                  ^^^
      
           foo ? bar : baz
           ^^^
       
    • statements

      public final Nodes.StatementsNode statements
       Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
      
           if foo
             bar
             ^^^
             baz
             ^^^
           end
       
    • subsequent

      public final Nodes.Node subsequent
       Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
      
           if foo
             bar
           elsif baz
           ^^^^^^^^^
             qux
             ^^^
           end
           ^^^
      
           if foo then bar else baz end
                           ^^^^^^^^^^^^
       
  • Constructor Details

  • Method Details