mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 01:14:40 +00:00
Add missing type information for soa structs
This commit is contained in:
@@ -2088,6 +2088,8 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
t = default_type(t);
|
||||
|
||||
add_type_info_type(c, t);
|
||||
GB_ASSERT(t_type_info_ptr != nullptr);
|
||||
add_type_info_type(c, t_type_info_ptr);
|
||||
|
||||
if (is_operand_value(o) && is_type_typeid(t)) {
|
||||
add_package_dependency(c, "runtime", "__type_info_of");
|
||||
|
||||
@@ -2211,9 +2211,14 @@ gb_internal void add_min_dep_type_info(Checker *c, Type *t) {
|
||||
Entity *e = entry.value;
|
||||
switch (bt->Struct.soa_kind) {
|
||||
case StructSoa_Dynamic:
|
||||
add_min_dep_type_info(c, t_type_info_ptr); // append_soa
|
||||
|
||||
add_min_dep_type_info(c, t_allocator);
|
||||
/*fallthrough*/
|
||||
case StructSoa_Slice:
|
||||
add_min_dep_type_info(c, t_int);
|
||||
add_min_dep_type_info(c, t_uint);
|
||||
/*fallthrough*/
|
||||
case StructSoa_Fixed:
|
||||
add_min_dep_type_info(c, alloc_type_pointer(e->type));
|
||||
break;
|
||||
|
||||
@@ -2939,6 +2939,12 @@ gb_internal lbValue lb_build_unary_and(lbProcedure *p, Ast *expr) {
|
||||
} else if (is_type_soa_pointer(tv.type)) {
|
||||
ast_node(ie, IndexExpr, ue_expr);
|
||||
lbValue addr = lb_build_addr_ptr(p, ie->expr);
|
||||
|
||||
if (is_type_pointer(type_deref(addr.type))) {
|
||||
addr = lb_emit_load(p, addr);
|
||||
}
|
||||
GB_ASSERT(is_type_pointer(addr.type));
|
||||
|
||||
lbValue index = lb_build_expr(p, ie->index);
|
||||
|
||||
if (!build_context.no_bounds_check) {
|
||||
|
||||
@@ -9,7 +9,12 @@ gb_internal isize lb_type_info_index(CheckerInfo *info, Type *type, bool err_on_
|
||||
}
|
||||
}
|
||||
if (err_on_not_found) {
|
||||
GB_PANIC("NOT FOUND lb_type_info_index %s @ index %td", type_to_string(type), index);
|
||||
gb_printf_err("NOT FOUND lb_type_info_index:\n\t%s\n\t@ index %td\n\tmax count: %u\nFound:\n", type_to_string(type), index, set->count);
|
||||
for (auto const &entry : *set) {
|
||||
isize type_info_index = entry.key;
|
||||
gb_printf_err("\t%s\n", type_to_string(info->type_info_types[type_info_index]));
|
||||
}
|
||||
GB_PANIC("NOT FOUND");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user