diff options
Diffstat (limited to 'src/visitor.c')
-rw-r--r-- | src/visitor.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/visitor.c b/src/visitor.c index 65af934..bcea8e4 100644 --- a/src/visitor.c +++ b/src/visitor.c @@ -8,6 +8,8 @@ #include <stdlib.h> #include <string.h> +void visitor_reset() {} + visitor_t *init_visitor(parser_t *p) { visitor_t *v = (visitor_t *)malloc(sizeof(visitor_t)); if (v == NULL) @@ -535,8 +537,8 @@ ast_t *eval_list(visitor_t *v, ast_t *e) { } stack_push(v->stack_frame, stack_frame); ast_t *res = eval_expr(v, function->cdr); - stack_frame = stack_pop(v->stack_frame); - /* hash_table_free(stack_frame); */ + stack_pop(v->stack_frame); + hash_table_free_some(stack_frame); return res; } @@ -572,3 +574,10 @@ void eval_error(visitor_t *v, ast_t *e) { printf("ERROR: something went wrong with the visitor.\n"); exit(1); } + +void visitor_free(visitor_t *v) { + ast_free(v->root); + hash_table_free(v->eval_table); + stack_free(v->stack_frame); + free(v); +} |