Ruby 4.1.0dev (2026-05-15 revision 4d87d43b01dbb312eb1ff5fbbc6c9f33218d91a2)
Data Fields
pm_scope_node Struct Reference

Data Fields

pm_node_t base
 
struct pm_scope_nodeprevious
 
pm_node_tast_node
 
pm_node_tparameters
 
pm_node_tbody
 
pm_constant_id_list_t locals
 
const pm_parser_tparser
 
const pm_options_toptions
 
const pm_line_offset_list_tline_offsets
 
int32_t start_line
 
rb_encodingencoding
 
VALUEscript_lines
 This is a pointer to the list of script lines for the ISEQs that will be associated with this scope node.
 
rb_encodingfilepath_encoding
 This is the encoding of the actual filepath object that will be used when a FILE node is compiled or when the path has to be set on a syntax error.
 
int local_table_for_iseq_size
 
IDconstants
 
pm_index_lookup_table_t index_lookup_table
 A flat lookup table mapping constant IDs (or special IDs) to local variable indices.
 
int coverage_enabled
 
struct iseq_link_anchorpre_execution_anchor
 This will only be set on the top-level scope node.
 
size_t last_line
 Cached line hint for line offset list lookups.
 

Detailed Description

Definition at line 97 of file prism_compile.h.

Field Documentation

◆ ast_node

pm_node_t* pm_scope_node::ast_node

Definition at line 100 of file prism_compile.h.

◆ base

pm_node_t pm_scope_node::base

Definition at line 98 of file prism_compile.h.

◆ body

pm_node_t* pm_scope_node::body

Definition at line 102 of file prism_compile.h.

◆ constants

ID* pm_scope_node::constants

Definition at line 132 of file prism_compile.h.

◆ coverage_enabled

int pm_scope_node::coverage_enabled

Definition at line 143 of file prism_compile.h.

◆ encoding

rb_encoding* pm_scope_node::encoding

Definition at line 109 of file prism_compile.h.

◆ filepath_encoding

rb_encoding* pm_scope_node::filepath_encoding

This is the encoding of the actual filepath object that will be used when a FILE node is compiled or when the path has to be set on a syntax error.

Definition at line 126 of file prism_compile.h.

◆ index_lookup_table

pm_index_lookup_table_t pm_scope_node::index_lookup_table

A flat lookup table mapping constant IDs (or special IDs) to local variable indices.

When allocated from the compile data arena (child scopes), no explicit free is needed. When heap-allocated (top-level scope in pm_parse_process), owned is set to true so destroy can free it.

Definition at line 140 of file prism_compile.h.

◆ last_line

size_t pm_scope_node::last_line

Cached line hint for line offset list lookups.

Since the compiler walks the AST roughly in source order, consecutive lookups tend to be for nearby byte offsets. This avoids repeated binary searches.

Definition at line 156 of file prism_compile.h.

◆ line_offsets

const pm_line_offset_list_t* pm_scope_node::line_offsets

Definition at line 107 of file prism_compile.h.

◆ local_table_for_iseq_size

int pm_scope_node::local_table_for_iseq_size

Definition at line 130 of file prism_compile.h.

◆ locals

pm_constant_id_list_t pm_scope_node::locals

Definition at line 103 of file prism_compile.h.

◆ options

const pm_options_t* pm_scope_node::options

Definition at line 106 of file prism_compile.h.

◆ parameters

pm_node_t* pm_scope_node::parameters

Definition at line 101 of file prism_compile.h.

◆ parser

const pm_parser_t* pm_scope_node::parser

Definition at line 105 of file prism_compile.h.

◆ pre_execution_anchor

struct iseq_link_anchor* pm_scope_node::pre_execution_anchor

This will only be set on the top-level scope node.

It will contain all of the instructions pertaining to BEGIN{} nodes.

Definition at line 149 of file prism_compile.h.

◆ previous

struct pm_scope_node* pm_scope_node::previous

Definition at line 99 of file prism_compile.h.

◆ script_lines

VALUE* pm_scope_node::script_lines

This is a pointer to the list of script lines for the ISEQs that will be associated with this scope node.

It is only set if RubyVM.keep_script_lines is true. If it is set, it will be set to a pointer to an array that is always stack allocated (so no GC marking is needed by this struct). If it is not set, it will be NULL. It is inherited by all child scopes.

Definition at line 119 of file prism_compile.h.

◆ start_line

int32_t pm_scope_node::start_line

Definition at line 108 of file prism_compile.h.


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