Class: Ikra::AST::WhilePostNode

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:) ⇒ WhilePostNode

Returns a new instance of WhilePostNode.



486
487
488
489
490
491
492
# File 'lib/ast/nodes.rb', line 486

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.



484
485
486
# File 'lib/ast/nodes.rb', line 484

def body_stmts
  @body_stmts
end

#conditionObject (readonly)

Returns the value of attribute condition.



483
484
485
# File 'lib/ast/nodes.rb', line 483

def condition
  @condition
end

Instance Method Details

#accept(visitor) ⇒ Object



140
141
142
# File 'lib/ast/visitor.rb', line 140

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

#cloneObject



494
495
496
497
498
# File 'lib/ast/nodes.rb', line 494

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

#to_sObject



132
133
134
# File 'lib/ast/printer.rb', line 132

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