inner let vals
[m6w6/ext-psi] / src / types / let_func.h
1 #ifndef _PSI_TYPES_LET_FUNC_H
2 #define _PSI_TYPES_LET_FUNC_H
3
4 typedef impl_val *(*let_func_handler)(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free);
5
6 struct let_val;
7 struct let_vals;
8 static inline void free_let_vals(struct let_vals *vals);
9
10 typedef struct let_func {
11 token_t type;
12 char *name;
13 impl_var *var;
14 let_func_handler handler;
15 struct let_vals *inner;
16 struct let_val *outer;
17 decl_arg *ref;
18 } let_func;
19
20 static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) {
21 let_func *func = calloc(1, sizeof(*func));
22 func->type = type;
23 func->name = strdup(name);
24 func->var = var;
25 return func;
26 }
27
28 static inline void free_let_func(let_func *func) {
29 free_impl_var(func->var);
30 free(func->name);
31 if (func->inner) {
32 free_let_vals(func->inner);
33 }
34 free(func);
35 }
36
37 #endif