mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 06:38:47 +00:00
Fix procedure groupings
This commit is contained in:
+15
-4
@@ -2572,7 +2572,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_entity_decl(c, entity, nullptr, nullptr);
|
check_entity_decl(c, entity, nullptr, nullptr);
|
||||||
GB_ASSERT(entity->type != nullptr);
|
GB_ASSERT(entity->type != nullptr || entity->kind == Entity_ProcedureGrouping);
|
||||||
|
|
||||||
if (is_alias) {
|
if (is_alias) {
|
||||||
// TODO(bill): Which scope do you search for for an alias?
|
// TODO(bill): Which scope do you search for for an alias?
|
||||||
@@ -2592,13 +2592,20 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Entity **procs = nullptr;
|
||||||
|
|
||||||
if (is_overloaded) {
|
if (is_overloaded) {
|
||||||
HashKey key = hash_string(entity_name);
|
HashKey key = hash_string(entity_name);
|
||||||
bool skip = false;
|
procs = gb_alloc_array(heap_allocator(), Entity *, overload_count);
|
||||||
|
|
||||||
Entity **procs = gb_alloc_array(heap_allocator(), Entity *, overload_count);
|
|
||||||
multi_map_get_all(&import_scope->elements, key, procs);
|
multi_map_get_all(&import_scope->elements, key, procs);
|
||||||
|
} else if (entity->kind == Entity_ProcedureGrouping) {
|
||||||
|
is_overloaded = true;
|
||||||
|
procs = entity->ProcedureGrouping.entities.data;
|
||||||
|
overload_count = entity->ProcedureGrouping.entities.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_overloaded) {
|
||||||
|
bool skip = false;
|
||||||
for (isize i = 0; i < overload_count; i++) {
|
for (isize i = 0; i < overload_count; i++) {
|
||||||
Type *t = base_type(procs[i]->type);
|
Type *t = base_type(procs[i]->type);
|
||||||
if (t == t_invalid) {
|
if (t == t_invalid) {
|
||||||
@@ -2784,6 +2791,10 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
|
|||||||
operand->builtin_id = cast(BuiltinProcId)entity->Builtin.id;
|
operand->builtin_id = cast(BuiltinProcId)entity->Builtin.id;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Entity_ProcedureGrouping:
|
||||||
|
entity->type = t_invalid;
|
||||||
|
break;
|
||||||
|
|
||||||
// NOTE(bill): These cases should never be hit but are here for sanity reasons
|
// NOTE(bill): These cases should never be hit but are here for sanity reasons
|
||||||
case Entity_Nil:
|
case Entity_Nil:
|
||||||
operand->mode = Addressing_Value;
|
operand->mode = Addressing_Value;
|
||||||
|
|||||||
Reference in New Issue
Block a user