2024-11-24 20:50:12 +00:00
|
|
|
#include "iterate.h"
|
2024-11-27 12:56:10 +00:00
|
|
|
#include "node.h"
|
|
|
|
|
|
|
|
|
|
#include <ivy/lang/ast.h>
|
2024-11-24 11:10:42 +00:00
|
|
|
|
2024-11-27 12:56:10 +00:00
|
|
|
static void collect_children(
|
|
|
|
|
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
2024-11-24 11:10:42 +00:00
|
|
|
{
|
2024-11-24 20:50:12 +00:00
|
|
|
struct ivy_ast_unit_node *unit = (struct ivy_ast_unit_node *)node;
|
2026-03-16 14:07:33 +00:00
|
|
|
fx_queue_entry *entry = fx_queue_first(&unit->n_children);
|
2025-11-06 10:38:32 +00:00
|
|
|
while (entry) {
|
2024-11-27 12:56:10 +00:00
|
|
|
struct ivy_ast_node *child
|
2026-03-16 14:07:33 +00:00
|
|
|
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
2024-11-24 20:50:12 +00:00
|
|
|
ast_node_iterator_enqueue_node(iterator, node, child);
|
2026-03-16 14:07:33 +00:00
|
|
|
entry = fx_queue_next(entry);
|
2024-11-24 20:50:12 +00:00
|
|
|
}
|
2024-11-24 11:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ast_node_type unit_node_ops = {
|
2024-11-24 20:50:12 +00:00
|
|
|
.n_collect_children = collect_children,
|
2024-11-24 11:46:42 +00:00
|
|
|
.n_node_size = sizeof(struct ivy_ast_unit_node),
|
2024-11-24 11:10:42 +00:00
|
|
|
};
|