Files
ivy/lang/ast/block.c
T

34 lines
896 B
C

#include "block.h"
#include "iterate.h"
#include "node.h"
#include <fx/ds/string.h>
#include <ivy/lang/lex.h>
static void collect_children(
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
{
struct ivy_ast_block_node *block = (struct ivy_ast_block_node *)node;
fx_queue_entry *entry = fx_queue_first(&block->n_arg);
while (entry) {
struct ivy_ast_node *expr
= fx_unbox(struct ivy_ast_node, entry, n_entry);
ast_node_iterator_enqueue_node(iterator, node, expr);
entry = fx_queue_next(entry);
}
entry = fx_queue_first(&block->n_expr);
while (entry) {
struct ivy_ast_node *expr
= fx_unbox(struct ivy_ast_node, entry, n_entry);
ast_node_iterator_enqueue_node(iterator, node, expr);
entry = fx_queue_next(entry);
}
}
struct ast_node_type block_node_ops = {
.n_collect_children = collect_children,
.n_node_size = sizeof(struct ivy_ast_block_node),
};