diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-07-04 22:42:25 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-07-04 22:42:25 +0100 |
| commit | 188bc28f6a06a29a117b36c9e8c45f0fe08465c7 (patch) | |
| tree | 79384247828673ddc6b137769b5b6ecca0190f20 /src/checker.cpp | |
| parent | 689a0c0b4955e5325c5409855632a3d4a154b41e (diff) | |
Allow for overloading of polymorphic procedures
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 3586f7986..6ea755d38 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -33,7 +33,7 @@ enum BuiltinProcId { BuiltinProc_reserve, BuiltinProc_clear, - BuiltinProc_append, + // BuiltinProc_append, BuiltinProc_delete, BuiltinProc_size_of, @@ -85,7 +85,7 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_COUNT] = { {STR_LIT("reserve"), 2, false, Expr_Stmt}, {STR_LIT("clear"), 1, false, Expr_Stmt}, - {STR_LIT("append"), 1, true, Expr_Expr}, + // {STR_LIT("append"), 1, true, Expr_Expr}, {STR_LIT("delete"), 2, false, Expr_Stmt}, {STR_LIT("size_of"), 1, false, Expr_Expr}, @@ -591,11 +591,9 @@ Entity *scope_insert_entity(Scope *s, Entity *entity) { } } - if (prev != NULL && - entity->kind == Entity_Procedure) { - if (s->is_global) { - return prev; - } + if (prev != NULL && entity->kind == Entity_Procedure) { + // if (s->is_global) return prev; + multi_map_insert(&s->elements, key, entity); } else { map_set(&s->elements, key, entity); @@ -1709,6 +1707,9 @@ void check_collect_entities(Checker *c, Array<AstNode *> nodes, bool is_file_sco if (is_ast_node_type(init)) { e = make_entity_type_name(c->allocator, d->scope, name->Ident.token, NULL); + if (vd->type != NULL) { + error(name, "A type declaration cannot have an type parameter"); + } d->type_expr = init; d->init_expr = init; } else if (init->kind == AstNode_ProcLit) { @@ -2285,10 +2286,9 @@ void check_parsed_files(Checker *c) { defer (c->context = prev_context); TypeProc *pt = &pi->type->Proc; + String name = pi->token.string; if (pt->is_polymorphic) { - if (pi->decl->gen_proc_type == NULL) { - continue; - } + GB_ASSERT_MSG(pt->is_poly_specialized, "%.*s", LIT(name)); } add_curr_ast_file(c, pi->file); |