Class: Ikra::AST::ReturnNode

Inherits:
TreeNode show all
Defined in:
lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb

Constant Summary

Constants inherited from TreeNode

TreeNode::TYPE_INFO_VARS

Instance Attribute Summary collapse

Attributes inherited from Node

#parent

Instance Method Summary collapse

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

#==, #eql?, #hash

Constructor Details

#initialize(value:) ⇒ ReturnNode

Returns a new instance of ReturnNode.



687
688
689
690
691
# File 'lib/ast/nodes.rb', line 687

def initialize(value:)
    @value = value

    value.parent = self
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



685
686
687
# File 'lib/ast/nodes.rb', line 685

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



188
189
190
# File 'lib/ast/visitor.rb', line 188

def accept(visitor)
    return visitor.visit_return_node(self)
end

#cloneObject



693
694
695
# File 'lib/ast/nodes.rb', line 693

def clone
    return ReturnNode.new(value: value.clone)
end

#to_sObject



192
193
194
# File 'lib/ast/printer.rb', line 192

def to_s
    return "[ReturnNode: #{value.to_s}]"
end