aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-02-23 11:38:23 +0000
committergingerBill <bill@gingerbill.org>2024-02-23 11:38:23 +0000
commita642ea0b28f8b1edad247b484ae000f20218347d (patch)
tree9cbf5f391bea3fcf3aac834013e50b87d5786e91 /src/check_builtin.cpp
parent00fc4c4e1bfea6b61e8b869a61a4f0560b1931dd (diff)
Add `intrinsics.type_bit_set_backing_type`
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index d39be37a9..c85fb28d6 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -5820,6 +5820,26 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
}
break;
+ case BuiltinProc_type_bit_set_backing_type:
+ {
+ Operand op = {};
+ Type *type = check_type(c, ce->args[0]);
+ Type *bt = base_type(type);
+ if (bt == nullptr || bt == t_invalid) {
+ error(ce->args[0], "Expected a type for '%.*s'", LIT(builtin_name));
+ return false;
+ }
+ if (bt->kind != Type_BitSet) {
+ gbString s = type_to_string(type);
+ error(ce->args[0], "Expected a bit_set type for '%.*s', got %s", LIT(builtin_name), s);
+ return false;
+ }
+
+ operand->mode = Addressing_Type;
+ operand->type = bit_set_to_int(bt);
+ break;
+ }
+
case BuiltinProc_type_equal_proc:
{
Operand op = {};