25 lines
575 B
C
25 lines
575 B
C
#include "iterate.h"
|
|
#include "node.h"
|
|
|
|
#include <ivy/lang/ast.h>
|
|
|
|
static void collect_children(
|
|
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
|
{
|
|
struct ivy_ast_while_loop_node *loop
|
|
= (struct ivy_ast_while_loop_node *)node;
|
|
|
|
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),
|
|
};
|