Class: Duby::AST::JRubyAst::FCallNode

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

Instance Method Summary collapse

Instance Method Details

#signature(parent) ⇒ Object



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

def signature(parent)
  case name
  when "returns"
    @declaration = true
    {:return => args_node.get(0).type_reference(parent)}
  when "throws"
    @declaration = true
    exceptions = args_node.child_nodes.map do |node|
      node.type_reference(parent)
    end
    {:throws =>  exceptions}
  else
    nil
  end
end

#transform(transformer, parent) ⇒ Object



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/duby/transform.rb', line 638

def transform(transformer, parent)
  @declaration ||= false

  if @declaration
    return Noop.new(parent, position)
  end

  macro = AST.macro(name)
  if macro
    transformer.expand(self, parent, &macro)
  else
    FunctionalCall.new(parent, position, name) do |call|
      [
        args_node ? args_node.child_nodes.map {|arg| transformer.transform(arg, call)} : [],
        iter_node ? transformer.transform(iter_node, call) : nil
      ]
    end
  end
end

#type_reference(parent) ⇒ Object



658
659
660
# File 'lib/duby/transform.rb', line 658

def type_reference(parent)
  AST::type(name)
end