diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-07-04 22:42:41 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-07-04 22:42:41 +0100 |
| commit | 82696179e8b48a78f7cad2d4b43e0b8a7281f47a (patch) | |
| tree | 5ef1612462ab90a1bcdca267d3f08822e98037b7 /src/check_decl.cpp | |
| parent | 188bc28f6a06a29a117b36c9e8c45f0fe08465c7 (diff) | |
| parent | 240da5c8e047acf14802fe1fc2a9d93fc374ca72 (diff) | |
Merge branch 'master' of https://github.com/gingerBill/Odin
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index e363ce3e6..35f74b91a 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -215,6 +215,7 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init, return; } break; + // NOTE(bill): Check to see if the expression it to be aliases case Addressing_Builtin: if (e->type != NULL) { error(type_expr, "A constant alias of a built-in procedure may not have a type initializer"); @@ -233,6 +234,11 @@ void check_const_decl(Checker *c, Entity *e, AstNode *type_expr, AstNode *init, if (entity != NULL) { switch (entity->kind) { + case Entity_Alias: + e->kind = Entity_Alias; + e->type = entity->type; + e->Alias.base = entity->Alias.base; + return; case Entity_Procedure: e->kind = Entity_Alias; e->type = entity->type; @@ -393,10 +399,10 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) { } #endif - bool prev_allow_polymorphic_types = c->context.allow_polymorphic_types; + auto prev_context = c->context; c->context.allow_polymorphic_types = true; check_procedure_type(c, proc_type, pl->type); - c->context.allow_polymorphic_types = prev_allow_polymorphic_types; + c->context = prev_context; bool is_foreign = (pl->tags & ProcTag_foreign) != 0; bool is_link_name = (pl->tags & ProcTag_link_name) != 0; |