Add helper for generating arg lists.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/71c836a2 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/71c836a2 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/71c836a2 Branch: refs/heads/master Commit: 71c836a2a2329c3a999ce102a6bd38f1b0f08169 Parents: d88c0bf Author: Marvin Humphrey <[email protected]> Authored: Tue Feb 2 16:08:54 2016 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Wed Feb 24 15:36:07 2016 -0800 ---------------------------------------------------------------------- compiler/src/CFCPyMethod.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71c836a2/compiler/src/CFCPyMethod.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCPyMethod.c b/compiler/src/CFCPyMethod.c index 450c26e..4220aea 100644 --- a/compiler/src/CFCPyMethod.c +++ b/compiler/src/CFCPyMethod.c @@ -473,6 +473,26 @@ S_gen_decrefs(CFCParamList *param_list, int first_tick) { return decrefs; } +static char* +S_gen_arg_list(CFCParamList *param_list, const char *first_arg) { + CFCVariable **vars = CFCParamList_get_variables(param_list); + int num_vars = CFCParamList_num_vars(param_list); + char *arg_list = CFCUtil_strdup(""); + for (int i = 0; i < num_vars; i++) { + if (i > 0) { + arg_list = CFCUtil_cat(arg_list, ", ", NULL); + } + if (i == 0 && first_arg != NULL) { + arg_list = CFCUtil_cat(arg_list, first_arg, NULL); + } + else { + arg_list = CFCUtil_cat(arg_list, CFCVariable_get_name(vars[i]), + "_ARG", NULL); + } + } + return arg_list; +} + char* CFCPyMethod_wrapper(CFCMethod *method, CFCClass *invoker) { CFCParamList *param_list = CFCMethod_get_param_list(method);
