Class: Ikra::AST::HashNode
- Defined in:
- lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb
Constant Summary
Constants inherited from TreeNode
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #clone ⇒ Object
-
#initialize(hash:) ⇒ HashNode
constructor
A new instance of HashNode.
- #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(hash:) ⇒ HashNode
Returns a new instance of HashNode.
309 310 311 |
# File 'lib/ast/nodes.rb', line 309 def initialize(hash:) @hash = hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
307 308 309 |
# File 'lib/ast/nodes.rb', line 307 def hash @hash end |
Instance Method Details
#accept(visitor) ⇒ Object
62 63 64 |
# File 'lib/ast/visitor.rb', line 62 def accept(visitor) visitor.visit_hash_node(self) end |
#clone ⇒ Object
313 314 315 316 |
# File 'lib/ast/nodes.rb', line 313 def clone # TODO: Clone properly return HashNode.new(hash: @hash.clone) end |
#to_s ⇒ Object
58 59 60 61 62 |
# File 'lib/ast/printer.rb', line 58 def to_s return "[HashNode: {" + hash.map do |key, value| "#{key.to_s} => #{value.to_s}" end.join(", ") + "}]" end |