api refactoring
[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 typedef struct let_func {
7 token_t type;
8 char *name;
9 impl_var *var;
10 let_func_handler handler;
11 } let_func;
12
13 static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) {
14 let_func *func = calloc(1, sizeof(*func));
15 func->type = type;
16 func->name = strdup(name);
17 func->var = var;
18 return func;
19 }
20
21 static inline void free_let_func(let_func *func) {
22 free_impl_var(func->var);
23 free(func->name);
24 free(func);
25 }
26
27 #endif