mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-18 20:40:28 +00:00
Add intrinsics.type_bit_set_backing_type
This commit is contained in:
@@ -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 = {};
|
||||
|
||||
@@ -282,6 +282,8 @@ BuiltinProc__type_simple_boolean_end,
|
||||
|
||||
BuiltinProc_type_field_index_of,
|
||||
|
||||
BuiltinProc_type_bit_set_backing_type,
|
||||
|
||||
BuiltinProc_type_equal_proc,
|
||||
BuiltinProc_type_hasher_proc,
|
||||
BuiltinProc_type_map_info,
|
||||
@@ -586,6 +588,8 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_COUNT] = {
|
||||
|
||||
{STR_LIT("type_field_index_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
|
||||
{STR_LIT("type_bit_set_backing_type"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
|
||||
{STR_LIT("type_equal_proc"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
{STR_LIT("type_hasher_proc"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
{STR_LIT("type_map_info"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
|
||||
|
||||
Reference in New Issue
Block a user