class Ikra::AST::ForNode

Attributes

body_stmts[R]
iterator_identifier[R]
range_from[R]
range_to[R]

Public Class Methods

new(iterator_identifier:, range_from:, range_to:, body_stmts: BeginNode.new) click to toggle source
# File lib/ast/nodes.rb, line 443
def initialize(iterator_identifier:, range_from:, range_to:, body_stmts: BeginNode.new)
    @iterator_identifier = iterator_identifier
    @range_from = range_from
    @range_to = range_to
    @body_stmts = body_stmts

    range_from.parent = self
    range_to.parent = self
    body_stmts.parent = self
end

Public Instance Methods

accept(visitor) click to toggle source
# File lib/ast/visitor.rb, line 128
def accept(visitor)
    visitor.visit_for_node(self)
end
clone() click to toggle source
# File lib/ast/nodes.rb, line 454
def clone
    return ForNode.new(
        iterator_identifier: @iterator_identifier,
        range_from: @range_from.clone,
        range_to: @range_to.clone,
        body_stmts: @body_stmts.clone)
end
to_s() click to toggle source
# File lib/ast/printer.rb, line 120
def to_s
    return "[ForNode: #{iterator_identifier.to_s} := #{range_from.to_s}...#{range_to.to_s}, #{body_stmts.to_s}]"
end