hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 25cecb7..e420ba3 100644
--- a/ast.c
+++ b/ast.c
@@ -45,6 +45,16 @@ struct Node* node_binary(enum NodeKind kind, struct Node* first, struct Node* se
return node;
}
+struct Node* node_ternary(enum NodeKind kind, struct Node* first, struct Node* second,
+ struct Node* third)
+{
+ struct Node* node = node_new(kind);
+ node->first = first;
+ node->second = second;
+ node->third = third;
+ return node;
+}
+
struct Node* node_append(struct Node* list, struct Node* node)
{
struct Node* last = list;
@@ -63,6 +73,7 @@ void node_free(struct Node* node)
return;
node_free(node->first);
node_free(node->second);
+ node_free(node->third);
node_free(node->next);
free(node);
}