Class: Ikra::AST::LVarReadNode
- Defined in:
- lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb,
lib/translator/variable_classifier_visitor.rb
Constant Summary
Constants inherited from TreeNode
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#variable_kind ⇒ Object
Returns the value of attribute variable_kind.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #clone ⇒ Object
-
#initialize(identifier:) ⇒ LVarReadNode
constructor
A new instance of LVarReadNode.
- #mangled_identifier ⇒ Object
- #to_s ⇒ Object
Methods inherited from TreeNode
#==, #enclosing_class, #find_behavior_node, #get_type, #is_begin_node?, #merge_union_type, #register_type_change, #replace, #replace_child, #symbol_table
Methods inherited from Node
Constructor Details
#initialize(identifier:) ⇒ LVarReadNode
Returns a new instance of LVarReadNode.
334 335 336 |
# File 'lib/ast/nodes.rb', line 334 def initialize(identifier:) @identifier = identifier end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
332 333 334 |
# File 'lib/ast/nodes.rb', line 332 def identifier @identifier end |
#variable_kind ⇒ Object
Returns the value of attribute variable_kind.
8 9 10 |
# File 'lib/translator/variable_classifier_visitor.rb', line 8 def variable_kind @variable_kind end |
Instance Method Details
#accept(visitor) ⇒ Object
74 75 76 |
# File 'lib/ast/visitor.rb', line 74 def accept(visitor) visitor.visit_lvar_read_node(self) end |
#clone ⇒ Object
338 339 340 |
# File 'lib/ast/nodes.rb', line 338 def clone return LVarReadNode.new(identifier: @identifier) end |
#mangled_identifier ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/translator/variable_classifier_visitor.rb', line 10 def mangled_identifier if variable_kind == :lexical return Translator::Constants::LEXICAL_VAR_PREFIX + identifier.to_s else return identifier end end |
#to_s ⇒ Object
72 73 74 |
# File 'lib/ast/printer.rb', line 72 def to_s return "[LVarReadNode: #{identifier.to_s}]" end |