The arity of builtin functions can be retrieved from their prototype. So, create a generic .args method, doing the evaluation of all arguments present in the prototype. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- builtin.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builtin.c b/builtin.c index 26b612dc401b..0d4cb12cca22 100644 --- a/builtin.c +++ b/builtin.c @@ -83,6 +83,13 @@ error: return 0; } +static int args_prototype(struct expression *expr) +{ + struct symbol *fntype = expr->fn->ctype->ctype.base_type; + int n = symbol_list_size(fntype->arguments); + return eval_args(expr, n); +} + static int args_triadic(struct expression *expr) { return eval_args(expr, 3); -- 2.28.0