lang: codegen: replace codegen_value with a new system for passing different types of values between code generators
This commit is contained in:
@@ -147,13 +147,14 @@ static enum ivy_status state_init(
|
||||
|
||||
static enum ivy_status state_fini(
|
||||
struct ivy_codegen *gen, struct code_generator_state *state,
|
||||
struct mie_value **result)
|
||||
struct code_generator_value *result)
|
||||
{
|
||||
struct lambda_codegen_state *lambda = (struct lambda_codegen_state *)state;
|
||||
|
||||
switch_to_outer_block(gen, lambda);
|
||||
mie_module_add_function(gen->c_module, lambda->s_func, ".anon");
|
||||
*result = MIE_VALUE(lambda->s_ctx_external);
|
||||
result->v_type = CODE_GENERATOR_VALUE_MIE_VALUE;
|
||||
result->v_value.mie_value = MIE_VALUE(lambda->s_ctx_external);
|
||||
|
||||
codegen_var_map_fini(&lambda->s_args);
|
||||
codegen_var_map_fini(&lambda->s_captured_vars);
|
||||
@@ -244,19 +245,11 @@ static enum ivy_status capture_var(
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
static struct code_generator_result value_received(
|
||||
struct ivy_codegen *gen, struct code_generator_state *state,
|
||||
struct mie_value *value)
|
||||
{
|
||||
return CODEGEN_RESULT_OK(0);
|
||||
}
|
||||
|
||||
struct code_generator lambda_generator = {
|
||||
.g_type = CODE_GENERATOR_LAMBDA,
|
||||
.g_state_size = sizeof(struct lambda_codegen_state),
|
||||
.g_state_init = state_init,
|
||||
.g_state_fini = state_fini,
|
||||
.g_value_received = value_received,
|
||||
.g_resolve_var = resolve_var,
|
||||
.g_capture_var = capture_var,
|
||||
.g_node_generators = {
|
||||
|
||||
Reference in New Issue
Block a user