2024-12-06 09:53:09 +00:00
|
|
|
#include "iterate.h"
|
2026-04-06 18:25:43 +01:00
|
|
|
#include "node.h"
|
2024-12-04 22:22:25 +00:00
|
|
|
|
|
|
|
|
static void match_collect_children(
|
|
|
|
|
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
|
|
|
|
{
|
2024-12-06 09:53:09 +00:00
|
|
|
struct ivy_ast_match_node *match = (struct ivy_ast_match_node *)node;
|
2024-12-04 22:22:25 +00:00
|
|
|
|
|
|
|
|
ast_node_iterator_enqueue_node(iterator, node, match->n_cond);
|
|
|
|
|
|
2026-03-16 14:07:33 +00:00
|
|
|
fx_queue_entry *entry = fx_queue_first(&match->n_branches);
|
2025-11-06 10:38:32 +00:00
|
|
|
while (entry) {
|
2024-12-06 09:53:09 +00:00
|
|
|
struct ivy_ast_node *branch
|
2026-03-16 14:07:33 +00:00
|
|
|
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
2024-12-04 22:22:25 +00:00
|
|
|
ast_node_iterator_enqueue_node(iterator, node, branch);
|
2026-04-06 18:25:43 +01:00
|
|
|
entry = fx_queue_next(entry);
|
2024-12-04 22:22:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ast_node_type match_node_ops = {
|
|
|
|
|
.n_collect_children = match_collect_children,
|
2024-12-05 22:00:23 +00:00
|
|
|
.n_node_size = sizeof(struct ivy_ast_match_node),
|
2024-12-04 22:22:25 +00:00
|
|
|
};
|