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



777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
# File 'lib/duby/transform.rb', line 777

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