class Ikra::AST::TernaryNode

Attributes

condition[R]
false_val[R]
true_val[R]

Public Class Methods

new(condition:, true_val:, false_val:) click to toggle source
# File lib/ast/nodes.rb, line 581
def initialize(condition:, true_val:, false_val:)
    @condition = condition
    @true_val = true_val
    @false_val = false_val

    condition.parent = self
    true_val.parent = self
    false_val.parent = self
end

Public Instance Methods

accept(visitor) click to toggle source
# File lib/ast/visitor.rb, line 170
def accept(visitor)
    return visitor.visit_ternary_node(self)
end
clone() click to toggle source
# File lib/ast/nodes.rb, line 591
def clone
    return TernaryNode.new(
        condition: @condition.clone,
        true_val: @true_val.clone,
        false_val: @false_val.clone)
end
to_s() click to toggle source
# File lib/ast/printer.rb, line 166
def to_s
    return "[TernaryNode: #{condition.to_s}, #{true_val.to_s}, #{false_val.to_s}]"
end