Module: RParsec::Signature
Overview
To add declarative signature support.
Instance Method Summary collapse
-
#def_sig(sym, *types) ⇒ Object
Signatures = {}.
Instance Method Details
#def_sig(sym, *types) ⇒ Object
Signatures = {}
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rparsec/misc.rb', line 70 def def_sig sym, *types types.each_with_index do |t, i| unless t.kind_of? Class TypeChecker.check_arg_type Class, t, :def_sig, i unless t.kind_of? Array TypeChecker.check_arg_type Class, t, :def_sig, i unless t.length <= 1 TypeChecker.check_arg_array_type Class, t, :def_sig, i end end # Signatures[sym] = types __intercept_method_to_check_param_types__(sym, types) end |