From 155d1971b7cd56d3206808c36c6b40357bc31cbb Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Fri, 17 Jul 2026 03:20:34 -0700 Subject: almost fibonacci but it needs the type checker --- ast.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ast.c') diff --git a/ast.c b/ast.c index 44401cb..24a37cf 100644 --- a/ast.c +++ b/ast.c @@ -133,6 +133,17 @@ static void expr_destroy(struct expr_node* node) { } } +static void if_destroy(struct if_node* node) { + expr_destroy(node->cond); + free(node->cond); + stmt_destroy(node->true_branch); + free(node->true_branch); + if (node->false_branch != NULL) { + stmt_destroy(node->false_branch); + free(node->false_branch); + } +} + static void stmt_destroy(struct stmt_node* node) { switch (node->type) { case STMT_EMPTY: @@ -148,6 +159,10 @@ static void stmt_destroy(struct stmt_node* node) { break; case STMT_GROUP: group_destroy(&node->inner.group); + break; + case STMT_IF: + if_destroy(&node->inner.if_); + break; } } -- cgit v1.2.3