Class: Ikra::AST::LVarWriteNode
- Defined in:
- lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb,
lib/types/inference/ast_inference.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.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#variable_kind ⇒ Object
Returns the value of attribute variable_kind.
-
#variable_type ⇒ Object
Returns the value of attribute variable_type.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #clone ⇒ Object
-
#initialize(identifier:, value:) ⇒ LVarWriteNode
constructor
A new instance of LVarWriteNode.
- #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:, value:) ⇒ LVarWriteNode
Returns a new instance of LVarWriteNode.
347 348 349 350 351 352 |
# File 'lib/ast/nodes.rb', line 347 def initialize(identifier:, value:) @identifier = identifier @value = value value.parent = self end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
344 345 346 |
# File 'lib/ast/nodes.rb', line 344 def identifier @identifier end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
345 346 347 |
# File 'lib/ast/nodes.rb', line 345 def value @value end |
#variable_kind ⇒ Object
Returns the value of attribute variable_kind.
20 21 22 |
# File 'lib/translator/variable_classifier_visitor.rb', line 20 def variable_kind @variable_kind end |
#variable_type ⇒ Object
Returns the value of attribute variable_type.
48 49 50 |
# File 'lib/types/inference/ast_inference.rb', line 48 def variable_type @variable_type end |
Instance Method Details
#accept(visitor) ⇒ Object
80 81 82 |
# File 'lib/ast/visitor.rb', line 80 def accept(visitor) visitor.visit_lvar_write_node(self) end |
#clone ⇒ Object
354 355 356 357 358 |
# File 'lib/ast/nodes.rb', line 354 def clone return LVarWriteNode.new( identifier: @identifier, value: @value.clone) end |
#mangled_identifier ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/translator/variable_classifier_visitor.rb', line 22 def mangled_identifier if variable_kind == :lexical return Translator::Constants::LEXICAL_VAR_PREFIX + identifier.to_s else return identifier end end |
#to_s ⇒ Object
78 79 80 |
# File 'lib/ast/printer.rb', line 78 def to_s return "[LVarWriteNode: #{identifier.to_s} := #{value.to_s}]" end |