Remove #relative slices; Replace with #relative multi-pointers

This commit is contained in:
gingerBill
2023-08-05 16:05:39 +01:00
parent afa8eb2d6f
commit c91898a888
29 changed files with 367 additions and 452 deletions
+4 -4
View File
@@ -2778,16 +2778,16 @@ gb_internal bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, T
Type *relative_type = nullptr;
Type *base_type = check_type(ctx, rt->type);
if (!is_type_pointer(base_type) && !is_type_slice(base_type)) {
error(rt->type, "#relative types can only be a pointer or slice");
if (!is_type_pointer(base_type) && !is_type_multi_pointer(base_type)) {
error(rt->type, "#relative types can only be a pointer or multi-pointer");
relative_type = base_type;
} else if (base_integer == nullptr) {
relative_type = base_type;
} else {
if (is_type_pointer(base_type)) {
relative_type = alloc_type_relative_pointer(base_type, base_integer);
} else if (is_type_slice(base_type)) {
relative_type = alloc_type_relative_slice(base_type, base_integer);
} else if (is_type_multi_pointer(base_type)) {
relative_type = alloc_type_relative_multi_pointer(base_type, base_integer);
}
}
GB_ASSERT(relative_type != nullptr);