Class: Ikra::AST::WhilePostNode
- Defined in:
- lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb
Constant Summary
Constants inherited from TreeNode
Instance Attribute Summary collapse
-
#body_stmts ⇒ Object
readonly
Returns the value of attribute body_stmts.
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #clone ⇒ Object
-
#initialize(condition:, body_stmts:) ⇒ WhilePostNode
constructor
A new instance of WhilePostNode.
- #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(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_stmts ⇒ Object (readonly)
Returns the value of attribute body_stmts.
484 485 486 |
# File 'lib/ast/nodes.rb', line 484 def body_stmts @body_stmts end |
#condition ⇒ Object (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 |
#clone ⇒ Object
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_s ⇒ Object
132 133 134 |
# File 'lib/ast/printer.rb', line 132 def to_s return "[WhilePostNode: #{condition.to_s}, #{body_stmts.to_s}]" end |