mie: ir: add helper function to check if a value is a selector
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define MIE_CONST_H_
|
||||
|
||||
#include <mie/ir/value.h>
|
||||
#include <mie/type.h>
|
||||
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user