mie: add null IR value

This commit is contained in:
2025-09-08 15:33:25 +01:00
parent 2ff85a7505
commit dd0dcc9c0a
4 changed files with 28 additions and 2 deletions

View File

@@ -43,6 +43,14 @@ struct mie_ctx *mie_ctx_create(void)
out->ctx_true = MIE_CONST(mie_ctx_get_int(out, 1, 1));
out->ctx_false = MIE_CONST(mie_ctx_get_int(out, 0, 1));
out->ctx_null = malloc(sizeof *out->ctx_null);
if (!out->ctx_null) {
mie_ctx_destroy(out);
return NULL;
}
mie_value_init(out->ctx_null, MIE_VALUE_NONE);
out->ctx_sel_cache = b_hashmap_create(free, free);
out->ctx_string_cache = b_hashmap_create(free, free);
@@ -81,6 +89,10 @@ void mie_ctx_destroy(struct mie_ctx *ctx)
}
}
if (ctx->ctx_null) {
mie_value_destroy(ctx->ctx_null);
}
b_hashmap_release(ctx->ctx_sel_cache);
free(ctx);
@@ -107,6 +119,11 @@ struct mie_type *mie_ctx_get_type(struct mie_ctx *ctx, enum mie_type_id type_id)
return type;
}
struct mie_value *mie_ctx_get_null(struct mie_ctx *ctx)
{
return ctx->ctx_null;
}
struct mie_type *mie_ctx_get_int_type(struct mie_ctx *ctx, unsigned int nr_bits)
{
struct ctx_int_cache_entry *entry