lang: codegen: replace codegen_value with a new system for passing different types of values between code generators

This commit is contained in:
2025-09-08 16:17:29 +01:00
parent 7ee2e9dd81
commit 6844f498c5
12 changed files with 114 additions and 91 deletions

View File

@@ -142,7 +142,7 @@ static void serialise_selector(
static enum ivy_status state_fini(
struct ivy_codegen *gen, struct code_generator_state *state,
struct mie_value **result)
struct code_generator_value *result)
{
debug_printf("codegen: end of msg\n");
@@ -179,19 +179,20 @@ static enum ivy_status state_fini(
free(msg->s_args);
}
*result = msg_send;
result->v_type = CODE_GENERATOR_VALUE_MIE_VALUE;
result->v_value.mie_value = msg_send;
return IVY_OK;
}
static struct code_generator_result value_received(
struct ivy_codegen *gen, struct code_generator_state *state,
struct mie_value *value)
struct code_generator_value *value)
{
struct msg_codegen_state *msg = (struct msg_codegen_state *)state;
switch (msg->s_prev_part) {
case MSG_START:
msg->s_recipient = value;
msg->s_recipient = value->v_value.mie_value;
msg->s_prev_part = MSG_RECIPIENT;
break;
case MSG_RECIPIENT:
@@ -204,7 +205,7 @@ static struct code_generator_result value_received(
return CODEGEN_RESULT_ERR(IVY_ERR_BAD_SYNTAX);
}
msg->s_args[msg->s_nr_args++] = value;
msg->s_args[msg->s_nr_args++] = value->v_value.mie_value;
break;
default:
break;