Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
Data Fields
pm_scope Struct Reference

This struct represents a node in a linked list of scopes. More...

#include <parser.h>

Data Fields

struct pm_scopeprevious
 A pointer to the previous scope in the linked list. More...
 
pm_locals_t locals
 The IDs of the locals in the given scope. More...
 
pm_node_list_t implicit_parameters
 This is a list of the implicit parameters contained within the block. More...
 
pm_scope_parameters_t parameters
 This is a bitfield that indicates the parameters that are being used in this scope. More...
 
pm_shareable_constant_value_t shareable_constant
 The current state of constant shareability for this scope. More...
 
bool closed
 A boolean indicating whether or not this scope can see into its parent. More...
 

Detailed Description

This struct represents a node in a linked list of scopes.

Some scopes can see into their parent scopes, while others cannot.

Definition at line 580 of file parser.h.

Field Documentation

◆ closed

bool pm_scope::closed

A boolean indicating whether or not this scope can see into its parent.

If closed is true, then the scope cannot see into its parent.

Definition at line 626 of file parser.h.

◆ implicit_parameters

pm_node_list_t pm_scope::implicit_parameters

This is a list of the implicit parameters contained within the block.

These will be processed after the block is parsed to determine the kind of parameters node that should be used and to check if any errors need to be added.

Definition at line 593 of file parser.h.

◆ locals

pm_locals_t pm_scope::locals

The IDs of the locals in the given scope.

Definition at line 585 of file parser.h.

◆ parameters

pm_scope_parameters_t pm_scope::parameters

This is a bitfield that indicates the parameters that are being used in this scope.

It is a combination of the PM_SCOPE_PARAMETERS_* constants. There are three different kinds of parameters that can be used in a scope:

  • Ordinary parameters (e.g., def foo(bar); end)
  • Numbered parameters (e.g., def foo; _1; end)
  • The it parameter (e.g., def foo; it; end)

If ordinary parameters are being used, then certain parameters can be forwarded to another method/structure. Those are indicated by four additional bits in the params field. For example, some combinations of:

  • def foo(*); end
  • def foo(**); end
  • def foo(&); end
  • def foo(...); end

Definition at line 614 of file parser.h.

◆ previous

struct pm_scope* pm_scope::previous

A pointer to the previous scope in the linked list.

Definition at line 582 of file parser.h.

◆ shareable_constant

pm_shareable_constant_value_t pm_scope::shareable_constant

The current state of constant shareability for this scope.

This is changed by magic shareable_constant_value comments.

Definition at line 620 of file parser.h.


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