+static inline void psi_do_args(impl *impl) {
+ size_t i;
+
+ for (i = 0; i < impl->decl->args->count; ++i) {
+ impl->decl->call.args[i] = impl->decl->args->args[i]->let->ptr;
+ }
+}
+
+static inline void psi_do_varargs(impl *impl, void ***free_list) {
+ size_t i, j;
+ impl_vararg *va = &impl->func->args->vararg;
+ size_t vacount = va->args->count;
+ void **tmpvals = calloc(vacount, sizeof(*tmpvals));
+ token_t type = psi_let_fn(va->name->type->type);
+
+ va->types = calloc(vacount, sizeof(*va->types));
+ va->values = calloc(vacount, sizeof(*va->values));
+
+ for (i = 0, j = 0; i < vacount; ++i) {
+ impl_arg *vaarg = va->args->args[i];
+ void *to_free = NULL;
+
+ psi_let_val(type, vaarg, &va->values[i], NULL, &to_free);
+ if (to_free) {
+ *free_list = realloc(*free_list, (j + 1) * sizeof(*free_list));
+ (*free_list)[j++] = to_free;
+ }
+ }
+}
+