Class: C::Function

Inherits:
IndirectType show all
Defined in:
lib/cast/to_s.rb,
lib/cast/c_nodes.rb,
lib/cast/c_nodes.rb

Constant Summary

Constants inherited from Node

Node::INSPECT_TAB

Instance Attribute Summary

Attributes inherited from Node

#parent, #pos, #subclasses

Instance Method Summary collapse

Methods inherited from IndirectType

#direct_type, #direct_type=, #indirect_type

Methods inherited from Type

parse

Methods inherited from Node

#==, #=~, abstract, add_field, #assert_invariants, #attached?, child, #clone, #depth_first, #detach, #detached?, #dup, #each, #eql?, field, #fields, fields, #hash, inherited, initializer, #insert_next, #insert_prev, #inspect, inspect1, #list_next, #list_prev, #match?, #method_missing, new_at, #next, #node_after, #node_before, #postorder, #preorder, #prev, #remove_node, #replace_node, #replace_with, #reverse_depth_first, #reverse_each, #reverse_postorder, #reverse_preorder, subclasses_recursive, #swap_with

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class C::Node

Instance Method Details

#to_s(name = nil, no_types = false) ⇒ Object



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/cast/to_s.rb', line 455

def to_s(name=nil, no_types=false)
  str =
    if params.nil?
      paramstr = ''
    elsif params.empty?
      paramstr = 'void'
    else
      if no_types
        paramstr = params.map{|p| p.name}.join(', ')
      else
        paramstr = params.join(', ')
      end
    end
  var_args? and paramstr << ', ...'
  str = "#{name}(#{paramstr})"
  if type
    type.to_s(str)
  else
    str
  end
end