# File lib/function_table.rb, line 3 def initialize @functions = Hash.new do |h,k| h[k] = [] end end
# File lib/function_table.rb, line 14 def [](name) # HACK: just here for transition puts "\n# WARNING: FunctionTable.[] called from #{caller[0]}" if $DEBUG @functions[name].first end
# File lib/function_table.rb, line 24 def add_function(name, type) @functions[name] << type type end
# File lib/function_table.rb, line 9 def cheat(name) # HACK: just here for debugging puts "\n# WARNING: FunctionTable.cheat called from #{caller[0]}" if $DEBUG @functions[name] end
# File lib/function_table.rb, line 19 def has_key?(name) # HACK: just here for transition puts "\n# WARNING: FunctionTable.has_key? called from #{caller[0]}" if $DEBUG @functions.has_key?(name) end
# File lib/function_table.rb, line 29 def unify(name, type) success = false @functions[name].each do |o| # unify(type) begin o.unify type success = true rescue # ignore end end unless success then yield(name, type) if block_given? end type end