Method::print_fd_arg_list: keep track of position in flattened sequence
commitb2465e4caac1f0b8fa3e17acf5345c9cd6f2f299
authorSven Verdoolaege <sven@cerebras.net>
Wed, 31 Mar 2021 12:27:12 +0000 (31 14:27 +0200)
committerSven Verdoolaege <sven@cerebras.net>
Mon, 6 Sep 2021 20:36:15 +0000 (6 22:36 +0200)
tree907836789c603922442c762cdb45b84eeb6d1124
parentf3ec6ba17979ce7f5d88f8a4df57135aa6a18899
Method::print_fd_arg_list: keep track of position in flattened sequence

For the templated interface, the arguments of any callbacks
are spliced into the list of arguments.
If the callback is the last argument (aside from
the corresponding user pointer), then the splicing can be performed
purely locally.  However, if a callback appears in any other position
(in particular, if there are multiple callbacks), then the splicing
needs to be taken into account for any further arguments.
Let Method::print_fd_arg_list take care of the accounting.
Most callers ignore the extra argument to the Method::print_fd_arg_list
callback.  Only cpp_generator::class_printer::print_method_header
needs to know the position in the flattened list of arguments
because it needs to pass this position to the type printer.

Signed-off-by: Sven Verdoolaege <sven@cerebras.net>
interface/cpp.cc
interface/cpp.h
interface/generator.cc
interface/generator.h
interface/plain_cpp.cc
interface/template_cpp.cc