Class: Ikra::AST::UntilNode

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(condition:, body_stmts:) ⇒ UntilNode

Returns a new instance of UntilNode.



505
506
507
508
509
510
511
# File 'lib/ast/nodes.rb', line 505

def initialize(condition:, body_stmts:)
    @condition = condition
    @body_stmts = body_stmts

    condition.parent = self
    body_stmts.parent = self
end

Instance Attribute Details

#body_stmtsObject (readonly)

Returns the value of attribute body_stmts.



503
504
505
# File 'lib/ast/nodes.rb', line 503

def body_stmts
  @body_stmts
end

#conditionObject (readonly)

Returns the value of attribute condition.



502
503
504
# File 'lib/ast/nodes.rb', line 502

def condition
  @condition
end

Instance Method Details

#accept(visitor) ⇒ Object



146
147
148
# File 'lib/ast/visitor.rb', line 146

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

#cloneObject



513
514
515
516
517
# File 'lib/ast/nodes.rb', line 513

def clone
    return UntilNode.new(
        condition: @condition.clone,
        body_stmts: @body_stmts.clone)
end

#to_sObject



138
139
140
# File 'lib/ast/printer.rb', line 138

def to_s
    return "[UntilNode: #{condition.to_s}, #{body_stmts.to_s}]"
end