diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2017-12-06 11:11:53 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-06 11:11:53 +0000 |
| commit | acd1f83bd0c2e5e37ba92c4264a248ef2ebe77de (patch) | |
| tree | 35b51047463f67db1ae9b5056bc41e484d1cbcb5 /src | |
| parent | ba8371104d86b93af3054ed20bc2fdf8768052d9 (diff) | |
Fix procedure groupings
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_expr.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 1c4c33747..a81022d87 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -2572,7 +2572,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h } check_entity_decl(c, entity, nullptr, nullptr); - GB_ASSERT(entity->type != nullptr); + GB_ASSERT(entity->type != nullptr || entity->kind == Entity_ProcedureGrouping); if (is_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) { HashKey key = hash_string(entity_name); - bool skip = false; - - Entity **procs = gb_alloc_array(heap_allocator(), Entity *, overload_count); + procs = gb_alloc_array(heap_allocator(), Entity *, overload_count); 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++) { Type *t = base_type(procs[i]->type); 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; break; + case Entity_ProcedureGrouping: + entity->type = t_invalid; + break; + // NOTE(bill): These cases should never be hit but are here for sanity reasons case Entity_Nil: operand->mode = Addressing_Value; |