Class: Ikra::AST::ArrayNode
- Defined in:
- lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb
Constant Summary
Constants inherited from TreeNode
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #clone ⇒ Object
-
#initialize(values:) ⇒ ArrayNode
constructor
A new instance of ArrayNode.
- #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(values:) ⇒ ArrayNode
Returns a new instance of ArrayNode.
279 280 281 282 283 284 285 |
# File 'lib/ast/nodes.rb', line 279 def initialize(values:) @values = values for value in values value.parent = self end end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
277 278 279 |
# File 'lib/ast/nodes.rb', line 277 def values @values end |
Instance Method Details
#accept(visitor) ⇒ Object
50 51 52 |
# File 'lib/ast/visitor.rb', line 50 def accept(visitor) visitor.visit_array_node(self) end |
#clone ⇒ Object
287 288 289 290 |
# File 'lib/ast/nodes.rb', line 287 def clone return ArrayNode.new( values: @values.map do |v| v.clone end) end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/ast/printer.rb', line 46 def to_s return "[ArrayNode: [#{(values.map do |v| v.to_s end).join(', ')}]]" end |