Ruby: pm_unless_node Struct Reference

Ruby 3.4.5p51 (2025-07-16 revision 20cda200d3ce092571d0b5d342dadca69636cb0f)

Data Fields
pm_unless_node Struct Reference

UnlessNode. More...

`#include <ast.h>`

## Data Fields
pm_node_t | base
| The embedded base node.
pm_location_t | keyword_loc
| UnlessNode#keyword_loc.
struct pm_node * | predicate
| UnlessNode#predicate.
pm_location_t | then_keyword_loc
| UnlessNode#then_keyword_loc.
struct pm_statements_node * | statements
| UnlessNode#statements.
struct pm_else_node * | else_clause
| UnlessNode#else_clause.
pm_location_t | end_keyword_loc
| UnlessNode#end_keyword_loc.
Data Fields inherited from pm_node
pm_node_type_t | type
| This represents the type of the node.
pm_node_flags_t | flags
| This represents any flags on the node.
uint32_t | node_id
| The unique identifier for this node, which is deterministic based on the source.
pm_location_t | location
| This is the location of the node in the source.

## Detailed Description

UnlessNode.

Represents the use of the unless keyword, either in the block form or the modifier form.

    bar unless foo
    ^^^^^^^^^^^^^^

    unless foo then bar end
    ^^^^^^^^^^^^^^^^^^^^^^^

Type: PM_UNLESS_NODE

Definition at line 7450 of file ast.h.

## Field Documentation

## ◆ base

pm_node_t pm_unless_node::base

The embedded base node.

Definition at line 7452 of file ast.h.

Referenced by pm_dump_json().

## ◆ else_clause

struct pm_else_node* pm_unless_node::else_clause

UnlessNode#else_clause.

The else clause of the unless expression, if present.

    unless cond then bar else baz end
                         ^^^^^^^^

Definition at line 7510 of file ast.h.

Referenced by pm_dump_json(), pm_node_destroy(), and pm_visit_child_nodes().

## ◆ end_keyword_loc

pm_location_t pm_unless_node::end_keyword_loc

UnlessNode#end_keyword_loc.

The location of the end keyword, if present.

    unless cond then bar end
                         ^^^

Definition at line 7520 of file ast.h.

Referenced by pm_dump_json().

## ◆ keyword_loc

pm_location_t pm_unless_node::keyword_loc

UnlessNode#keyword_loc.

The location of the unless keyword.

    unless cond then bar end
    ^^^^^^

    bar unless cond
        ^^^^^^

Definition at line 7466 of file ast.h.

Referenced by pm_dump_json().

## ◆ predicate

struct pm_node* pm_unless_node::predicate

UnlessNode#predicate.

The condition to be evaluated for the unless expression. It can be any non-void expression.

    unless cond then bar end
           ^^^^

    bar unless cond
               ^^^^

Definition at line 7479 of file ast.h.

Referenced by pm_dump_json(), pm_node_destroy(), and pm_visit_child_nodes().

## ◆ statements

struct pm_statements_node* pm_unless_node::statements

UnlessNode#statements.

The body of statements that will executed if the unless condition is falsey. Will be nil if no body is provided.

    unless cond then bar end
                     ^^^

Definition at line 7500 of file ast.h.

Referenced by pm_dump_json(), pm_node_destroy(), and pm_visit_child_nodes().

## ◆ then_keyword_loc

pm_location_t pm_unless_node::then_keyword_loc

UnlessNode#then_keyword_loc.

The location of the then keyword, if present.

    unless cond then bar end
                ^^^^

Definition at line 7489 of file ast.h.

Referenced by pm_dump_json().

The documentation for this struct was generated from the following file:

- prism/ast.h