pm_if_node_t

Type Alias pm_if_node_t 

Source
pub type pm_if_node_t = pm_if_node;
Expand description

IfNode

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
 ^^^^^^^^^^^^^^^

Type: ::PM_IF_NODE

@extends pm_node_t

Aliased Type§

#[repr(C)]
pub struct pm_if_node_t { pub base: pm_node, pub if_keyword_loc: pm_location_t, pub predicate: *mut pm_node, pub then_keyword_loc: pm_location_t, pub statements: *mut pm_statements_node, pub subsequent: *mut pm_node, pub end_keyword_loc: pm_location_t, }

Fields§

§base: pm_node

The embedded base node.

§if_keyword_loc: pm_location_t

IfNode#if_keyword_loc

The location of the if keyword if present.

 bar if foo
     ^^

The if_keyword_loc field will be nil when the IfNode represents a ternary expression.

§predicate: *mut pm_node

IfNode#predicate

The node for the condition the IfNode is testing.

 if foo
    ^^^
   bar
 end
 bar if foo
        ^^^
 foo ? bar : baz
 ^^^
§then_keyword_loc: pm_location_t

IfNode#then_keyword_loc

The location of the then keyword (if present) or the ? in a ternary expression, nil otherwise.

 if foo then bar end
        ^^^^
 a ? b : c
   ^
§statements: *mut pm_statements_node

IfNode#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: *mut pm_node

IfNode#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
                 ^^^^^^^^^^^^
§end_keyword_loc: pm_location_t

IfNode#end_keyword_loc

The location of the end keyword if present, nil otherwise.

 if foo
   bar
 end
 ^^^