2024-11-28 22:05:37 +00:00
|
|
|
#include "ctx.h"
|
2024-12-01 13:25:36 +00:00
|
|
|
#include "iterate.h"
|
2024-11-28 22:05:37 +00:00
|
|
|
#include "node.h"
|
|
|
|
|
|
|
|
|
|
static void collect_children(
|
|
|
|
|
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
|
|
|
|
{
|
|
|
|
|
struct ivy_ast_msg_node *msg = (struct ivy_ast_msg_node *)node;
|
|
|
|
|
|
|
|
|
|
if (msg->n_recipient) {
|
|
|
|
|
ast_node_iterator_enqueue_node(iterator, node, msg->n_recipient);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msg->n_sel) {
|
2024-12-01 13:25:36 +00:00
|
|
|
ast_node_iterator_enqueue_node(
|
|
|
|
|
iterator, node, (struct ivy_ast_node *)msg->n_sel);
|
2024-11-28 22:05:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b_queue_iterator it = {0};
|
|
|
|
|
b_queue_foreach (&it, &msg->n_arg) {
|
2024-12-01 13:25:36 +00:00
|
|
|
struct ivy_ast_node *arg
|
|
|
|
|
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
2024-11-28 22:05:37 +00:00
|
|
|
ast_node_iterator_enqueue_node(iterator, node, arg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ast_node_type msg_node_ops = {
|
|
|
|
|
.n_collect_children = collect_children,
|
2024-11-29 12:06:06 +00:00
|
|
|
.n_state_size = sizeof(struct parser_state),
|
|
|
|
|
.n_node_size = sizeof(struct ivy_ast_msg_node),
|
2024-11-28 22:05:37 +00:00
|
|
|
};
|