lang: ast: add a BLOCK ast node to hold lists of expressions

This commit is contained in:
2024-11-28 10:26:53 +00:00
parent 7f9894d8f9
commit 811d3787c4
6 changed files with 103 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ enum ivy_ast_node_type {
IVY_AST_MSG,
IVY_AST_CLASS,
IVY_AST_MSGH,
IVY_AST_BLOCK,
IVY_AST_SELECTOR,
IVY_AST_PROPERTY,
IVY_AST_LAMBDA,
@@ -33,7 +34,6 @@ enum ivy_ast_node_type {
IVY_AST_COND_GROUP,
IVY_AST_COND,
IVY_AST_TUPLE,
IVY_AST_DO,
IVY_AST_TYPE_COUNT,
};
@@ -104,8 +104,8 @@ 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;
/* queue of struct ivy_ast_node; expressions to evaluate when message handler is executed. */
b_queue n_body;
/* expressions to evaluate when lambda is executed. */
struct ivy_ast_block_node *n_body;
};
struct ivy_ast_property_node {
@@ -129,8 +129,8 @@ struct ivy_ast_lambda_node {
struct ivy_ast_node n_base;
/* queue of struct lex_token; contains the names of the lambda parameters. */
b_queue n_arg;
/* queue of struct ivy_ast_node; expressions to evaluate when lambda is executed. */
b_queue n_body;
/* expressions to evaluate when lambda is executed. */
struct ivy_ast_block_node *n_body;
};
struct ivy_ast_unit_package_node {
@@ -222,10 +222,10 @@ struct ivy_ast_tuple_node {
b_queue n_members;
};
struct ivy_ast_do_node {
struct ivy_ast_block_node {
struct ivy_ast_node n_base;
/* queue of struct ivy_ast_node. expressions to evaluate when the do node itself is evaluated. */
b_queue n_members;
b_queue n_expr;
};
typedef enum ivy_status (*ivy_ast_node_iteration_callback)(