X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Flet_func.h;fp=src%2Ftypes%2Flet_func.h;h=526265b9cbf0c9ec44c8e91b59e7f864b1b1d627;hp=0000000000000000000000000000000000000000;hb=5359ad5c181e5772f350fe1cba060cbed3a05b91;hpb=04a60b34fc18ea3a2638893eaf24514177692eeb diff --git a/src/types/let_func.h b/src/types/let_func.h new file mode 100644 index 0000000..526265b --- /dev/null +++ b/src/types/let_func.h @@ -0,0 +1,27 @@ +#ifndef _PSI_TYPES_LET_FUNC_H +#define _PSI_TYPES_LET_FUNC_H + +typedef impl_val *(*let_func_handler)(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free); + +typedef struct let_func { + token_t type; + char *name; + impl_var *var; + let_func_handler handler; +} let_func; + +static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) { + let_func *func = calloc(1, sizeof(*func)); + func->type = type; + func->name = strdup(name); + func->var = var; + return func; +} + +static inline void free_let_func(let_func *func) { + free_impl_var(func->var); + free(func->name); + free(func); +} + +#endif