2024-12-06 09:53:09 +00:00
|
|
|
#include "iterate.h"
|
2026-04-06 18:25:43 +01:00
|
|
|
#include "node.h"
|
2024-12-05 19:29:21 +00:00
|
|
|
|
2026-04-06 18:25:43 +01:00
|
|
|
#include <ivy/lang/ast.h>
|
2024-12-05 19:29:21 +00:00
|
|
|
|
|
|
|
|
static void collect_children(
|
|
|
|
|
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
|
|
|
|
{
|
2024-12-06 09:53:09 +00:00
|
|
|
struct ivy_ast_while_loop_node *loop
|
|
|
|
|
= (struct ivy_ast_while_loop_node *)node;
|
2024-12-05 19:29:21 +00:00
|
|
|
|
|
|
|
|
if (loop->n_cond) {
|
|
|
|
|
ast_node_iterator_enqueue_node(iterator, node, loop->n_cond);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (loop->n_body) {
|
|
|
|
|
ast_node_iterator_enqueue_node(iterator, node, loop->n_body);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ast_node_type while_loop_node_ops = {
|
|
|
|
|
.n_collect_children = collect_children,
|
|
|
|
|
.n_node_size = sizeof(struct ivy_ast_while_loop_node),
|
2024-12-06 09:53:09 +00:00
|
|
|
};
|