Class: Duby::AST::JRubyAst::AttrAssignNode

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

Instance Method Summary collapse

Instance Method Details

#transform(transformer, parent) ⇒ Object



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/duby/transform.rb', line 317

def transform(transformer, parent)
  case name
  when '[]='
    Call.new(parent, position, name) do |call|
      [
        transformer.transform(receiver_node, call),
        args_node ? args_node.child_nodes.map {|arg| transformer.transform(arg, call)} : [],
        nil
      ]
    end
  else
    new_name = name[0..-2] + '_set'
    Call.new(parent, position, new_name) do |call|
      [
        transformer.transform(receiver_node, call),
        args_node ? args_node.child_nodes.map {|arg| transformer.transform(arg, call)} : [],
        nil
      ]
    end
  end
end