lib-ruby-parser (C++ bindings)  4.0.1+ruby-3.1.1
C++ bindings for lib-ruby-parser library
lib_ruby_parser::Casgn Class Reference

Represents a constant assignment (i.e. A = 1) More...

#include <nodes.hpp>

Public Attributes

Nodescope
 
String name
 Name of the constant, String("A") for A = 1 More...
 
Nodevalue
 
MaybeLoc double_colon_l
 
Loc name_l
 
MaybeLoc operator_l
 
Loc expression_l
 

Detailed Description

Represents a constant assignment (i.e. A = 1)

Member Data Documentation

◆ double_colon_l

MaybeLoc lib_ruby_parser::Casgn::double_colon_l

Location of the :: operator

A::B = 1
^^
::A = 1
^^

None if the constant is defined in the current scope

◆ expression_l

Loc lib_ruby_parser::Casgn::expression_l

Location of the full expression

A = 1
^^^^^

◆ name

String lib_ruby_parser::Casgn::name

Name of the constant, String("A") for A = 1

◆ name_l

Loc lib_ruby_parser::Casgn::name_l

Location of the constant name

A::CONST = 1
^^^^^

◆ operator_l

MaybeLoc lib_ruby_parser::Casgn::operator_l

Location of the = operator

A = 1
^

None if constant assignment is a part of the multi-assignment. In such case = belongs to a Masgn node

◆ scope

Node* lib_ruby_parser::Casgn::scope

Scope where the constant is defined:

  1. Some(Const("A")) for A::B = 1
  2. None if it's defined in the current scope (i.e. A = 1)
  3. Some(Cbase) if it's defined in the global scope (i.e. ::A = 1)

◆ value

Node* lib_ruby_parser::Casgn::value

Value that is assigned to a constant, Int("1") for A = 1.

Note: None if constant assignment is a part of the multi-assignment. In such case value belongs to Masgn node of the multi-assignment.


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