diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-10 01:58:59 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-14 17:48:17 +0200 |
commit | 617e82a88719c44fff3753aaabedb3114823a034 (patch) | |
tree | af24c3a9f89e521c67eaaa56e67e4a80abef60ba | |
parent | 5192dc1ff23dae8644480a89ada8ff420ebb674a (diff) | |
download | sparse-617e82a88719c44fff3753aaabedb3114823a034.tar.gz |
builtin: add generic .args method
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@gmail.com>
-rw-r--r-- | builtin.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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); |