lang: codegen: msg generator can now accept recipient as a param rather than parsing it from the ast
This commit is contained in:
@@ -14,11 +14,17 @@ enum msg_part {
|
||||
MSG_ARG,
|
||||
};
|
||||
|
||||
enum msg_codegen_flags {
|
||||
MSG_F_SKIP_RECIPIENT = 0x01u,
|
||||
MSG_F_SKIP_RECIPIENT_DONE = 0x02u,
|
||||
};
|
||||
|
||||
struct msg_codegen_state {
|
||||
struct code_generator_state s_base;
|
||||
enum msg_part s_prev_part;
|
||||
|
||||
enum code_generator_flags s_flags;
|
||||
enum msg_codegen_flags s_msg_flags;
|
||||
struct mie_value *s_recipient;
|
||||
struct ivy_ast_selector_node *s_selector;
|
||||
struct mie_value **s_args;
|
||||
@@ -52,6 +58,12 @@ static struct code_generator_result gen_msg(
|
||||
return CODEGEN_RESULT_OK(0);
|
||||
}
|
||||
|
||||
if (msg->s_msg_flags & MSG_F_SKIP_RECIPIENT
|
||||
&& !(msg->s_msg_flags & MSG_F_SKIP_RECIPIENT_DONE)) {
|
||||
msg->s_msg_flags |= MSG_F_SKIP_RECIPIENT_DONE;
|
||||
return CODEGEN_RESULT_OK(0);
|
||||
}
|
||||
|
||||
codegen_push_generator(gen, CODE_GENERATOR_MSG, 0, NULL);
|
||||
|
||||
return CODEGEN_RESULT_OK(CODEGEN_R_REPEAT_NODE);
|
||||
@@ -103,6 +115,13 @@ static enum ivy_status state_init(
|
||||
debug_printf("codegen: start of msg\n");
|
||||
struct msg_codegen_state *msg = (struct msg_codegen_state *)state;
|
||||
msg->s_flags = argv;
|
||||
|
||||
if (argp) {
|
||||
msg->s_recipient = argp;
|
||||
msg->s_prev_part = MSG_RECIPIENT;
|
||||
msg->s_msg_flags = MSG_F_SKIP_RECIPIENT;
|
||||
}
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user