#ifndef RZ_FUN_H #define RZ_FUN_H #include "commons.h" #include "program.h" #include "err.h" struct sym; struct locals; struct value; typedef struct { int id; struct value* value; } closure_entry_t; typedef struct { program_t program; err_t* err; struct sym* sym; struct tysy* tysy; struct locals* locals; int base; int arg_base; struct { size_t size; size_t cap; closure_entry_t** data; } closure; } fun_t; void fun_init(fun_t* fun, struct tysy* tysy, err_t* err); fun_t* fun_new_clone(fun_t* fun); void fun_free(fun_t* fun); void fun_capture(fun_t* fun, int id, struct value* value); closure_entry_t* fun_try_find_closure(fun_t* fun, int id); #endif