Class: Duby::AST::JRubyAst::OpElementAsgnNode

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

Instance Method Summary collapse

Methods included from CallOpAssignment

#call_op_assignment

Instance Method Details

#transform(transformer, parent) ⇒ Object



623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
# File 'lib/duby/transform.rb', line 623

def transform(transformer, parent)
  Body.new(parent, position) do |block|
    temps = []
    arg_init = args_node.map do |arg|
      temps << transformer.tmp
      LocalAssignment.new(block, arg.position, temps[-1]) do |l|
        [transformer.transform(arg, l)]
      end
    end
    args = ListNode.new(position)
    args_node.zip(temps) do |arg, temp_name|
      args.add(LocalVarNode.new(arg.position, 0, temp_name))
    end
    arg_init + [call_op_assignment(transformer, parent, '[]', args)]
  end
end