Class: Duby::AST::JRubyAst::OrNode

Inherits:
Object
  • Object
show all
Defined in:
lib/duby/transform.rb

Instance Method Summary collapse

Instance Method Details

#transform(transformer, parent) ⇒ Object



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/duby/transform.rb', line 585

def transform(transformer, parent)
  Body.new(parent, position) do |block|
    temp = transformer.tmp
    [
      LocalAssignment.new(block, first_node.position, temp) do |l|
        [transformer.transform(first_node, l)]
      end,
      If.new(parent, position) do |iff|
        [
          Condition.new(iff, first_node.position) do |cond|
            [Local.new(cond, first_node.position, temp)]
          end,
          Local.new(iff, first_node.position, temp),
          transformer.transform(second_node, iff)
        ]
      end
    ]
  end
end