From 4e7150b470fe9a0b0794fa9bdbac49ffc2c113be Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sun, 25 Jun 2017 22:29:23 +0100 Subject: Allow nested para-poly procedures --- src/check_expr.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/check_expr.cpp') diff --git a/src/check_expr.cpp b/src/check_expr.cpp index f61809078..460c449da 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -5075,6 +5075,27 @@ CALL_ARGUMENT_CHECKER(check_call_arguments_internal) { add_entity_use(c, ce->proc, gen_entity); check_procedure_later(c, c->curr_ast_file, token, d, final_proc_type, pd->body, tags); + + + auto *found = map_get(&c->info.gen_procs, hash_pointer(entity->identifier)); + if (found) { + bool ok = true; + for_array(i, *found) { + Entity *other = (*found)[i]; + if (are_types_identical(other->type, gen_entity->type)) { + ok = false; + break; + } + } + if (ok) { + array_add(found, gen_entity); + } + } else { + Array array = {}; + array_init(&array, heap_allocator()); + array_add(&array, gen_entity); + map_set(&c->info.gen_procs, hash_pointer(entity->identifier), array); + } } -- cgit v1.2.3