Naming, use variant index instead of tag

This commit is contained in:
jakubtomsu
2023-10-24 22:15:33 +02:00
parent 16c176dc89
commit c76ab138eb
2 changed files with 9 additions and 4 deletions

View File

@@ -162,7 +162,12 @@ type_is_matrix :: proc($T: typeid) -> bool ---
type_has_nil :: proc($T: typeid) -> bool ---
type_is_specialization_of :: proc($T, $S: typeid) -> bool ---
type_is_variant_of :: proc($U, $V: typeid) -> bool where type_is_union(U) ---
type_union_tag :: proc($U: typeid) -> typeid where type_is_union(U) ---
type_union_tag_offset :: proc($U: typeid) -> int where type_is_union(U) ---
type_variant_type_of_of :: proc($U: typeid, $index: int) -> typeid where type_is_union(U) ---
type_variant_index_of :: proc($U, $V: typeid) -> int where type_is_union(U) ---
type_has_field :: proc($T: typeid, $name: string) -> bool ---
type_field_type :: proc($T: typeid, $name: string) -> typeid ---

View File

@@ -262,8 +262,8 @@ BuiltinProc__type_simple_boolean_end,
BuiltinProc_type_is_variant_of,
BuiltinProc_type_union_tag,
BuiltinProc_type_union_tag_offset,
BuiltinProc_type_variant_type,
BuiltinProc_type_variant_tag,
BuiltinProc_type_variant_type_of,
BuiltinProc_type_variant_index_of,
BuiltinProc_type_struct_field_count,
@@ -564,8 +564,8 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_COUNT] = {
{STR_LIT("type_is_variant_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
{STR_LIT("type_union_tag"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
{STR_LIT("type_union_tag_offset"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},
{STR_LIT("type_variant_type"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
{STR_LIT("type_variant_tag"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
{STR_LIT("type_variant_type_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
{STR_LIT("type_variant_index_of"), 2, false, Expr_Expr, BuiltinProcPkg_intrinsics},
{STR_LIT("type_struct_field_count"), 1, false, Expr_Expr, BuiltinProcPkg_intrinsics},