generator: Create a separate type for optional arguments
authorMatthew Booth <mbooth@redhat.com>
Mon, 9 Jan 2012 10:16:35 +0000 (10:16 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 9 Jan 2012 13:30:34 +0000 (13:30 +0000)
commit0a7b734d2f54d4e98882532da9887feb66c9824a
tree0f7eb3d9ca6893aa5cb2b66669200a4e500c1701
parente24af214fe8f9dccac39ed520b57ce7d458f9fd1
generator: Create a separate type for optional arguments

Previously, optional arguments had the same type as regular arguments, but were
constrained by various runtime tests to be only Bool, Int, Int64 or String. This
change makes the type of optional arguments stronger by giving them their own
type.

A convenience function, optargs_to_args is defined to convert optargs in the few
places where they are genuinely treated identically to mandatory arguments.

It also allows for future changes to optional arguments which do not affect
mandatory arguments.

RWMJ:
 - removed redundant parens
 - readded the check for > 64 optargs, but changed it to > 63
 - changed the new function to args_of_optargs
17 files changed:
generator/generator_actions.ml
generator/generator_c.ml
generator/generator_checks.ml
generator/generator_daemon.ml
generator/generator_erlang.ml
generator/generator_fish.ml
generator/generator_java.ml
generator/generator_ocaml.ml
generator/generator_perl.ml
generator/generator_php.ml
generator/generator_python.ml
generator/generator_ruby.ml
generator/generator_tests_c_api.ml
generator/generator_types.ml
generator/generator_utils.ml
generator/generator_utils.mli
generator/generator_xdr.ml