lang: ast: move recipient tracking from msg handler node to selector node

This commit is contained in:
2024-11-28 16:58:01 +00:00
parent 4304b94491
commit 2a33ae44a5
4 changed files with 131 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
#include <blue/core/queue.h>
#include <ivy/lang/operator.h>
#include <ivy/lang/selector.h>
#include <ivy/misc.h>
#include <ivy/status.h>
@@ -37,12 +38,6 @@ enum ivy_ast_node_type {
IVY_AST_TYPE_COUNT,
};
enum ivy_ast_msgh_recipient_type {
IVY_AST_MSGH_NONE = 0,
IVY_AST_MSGH_OBJECT,
IVY_AST_MSGH_CLASS,
};
struct ivy_ast_node_iterator {
b_queue it_queue;
b_queue_entry *it_insert_after;
@@ -73,6 +68,7 @@ struct ivy_ast_op_node {
struct ivy_ast_selector_node {
struct ivy_ast_node n_base;
enum ivy_selector_recipient n_recipient;
/* NULL for keyword messages. */
struct ivy_token *n_msg_name;
/* queue of struct ivy_token; empty for unary messages. */
@@ -102,7 +98,6 @@ struct ivy_ast_class_node {
struct ivy_ast_msgh_node {
struct ivy_ast_node n_base;
enum ivy_ast_msgh_recipient_type n_recipient;
struct ivy_ast_selector_node *n_sel;
/* expressions to evaluate when lambda is executed. */
struct ivy_ast_block_node *n_body;
@@ -249,7 +244,5 @@ IVY_API void ivy_ast_node_print(struct ivy_ast_node *node);
IVY_API void ivy_ast_node_destroy(struct ivy_ast_node *node);
IVY_API const char *ivy_ast_node_type_to_string(enum ivy_ast_node_type v);
IVY_API const char *ivy_ast_msgh_recipient_type_to_string(
enum ivy_ast_msgh_recipient_type v);
#endif

View File

@@ -0,0 +1,10 @@
#ifndef IVY_LANG_SELECTOR_H_
#define IVY_LANG_SELECTOR_H_
enum ivy_selector_recipient {
IVY_SELECTOR_RECIPIENT_NONE = 0,
IVY_SELECTOR_RECIPIENT_CLASS,
IVY_SELECTOR_RECIPIENT_OBJECT,
};
#endif