From 3a8a3b59f0ca72ac4f93d78495cdb7cfd046317c Mon Sep 17 00:00:00 2001 From: Max Wash Date: Mon, 8 Sep 2025 15:40:33 +0100 Subject: [PATCH] mie: ir: add helper function to check if a value is a selector --- mie/include/mie/ir/const.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mie/include/mie/ir/const.h b/mie/include/mie/ir/const.h index b949454..e51f00f 100644 --- a/mie/include/mie/ir/const.h +++ b/mie/include/mie/ir/const.h @@ -2,6 +2,7 @@ #define MIE_CONST_H_ #include +#include #define MIE_CONST(p) ((struct mie_const *)(p)) @@ -51,4 +52,15 @@ struct mie_array { extern void mie_const_init(struct mie_const *c, struct mie_type *type); +static inline bool mie_value_is_selector(const struct mie_value *v) +{ + if (v->v_type->t_id != MIE_VALUE_CONST) { + return false; + } + + const struct mie_const *c = MIE_CONST(v); + + return c->c_type->t_id == MIE_TYPE_SELECTOR; +} + #endif