From 689a0c0b4955e5325c5409855632a3d4a154b41e Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Tue, 4 Jul 2017 11:23:48 +0100 Subject: *_of as keyords; Allow constant aliasing for user/built-in procedures, import names, and library names --- src/entity.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/entity.cpp') diff --git a/src/entity.cpp b/src/entity.cpp index e38a374fc..1f2478c25 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -12,6 +12,7 @@ struct DeclInfo; ENTITY_KIND(TypeName) \ ENTITY_KIND(Procedure) \ ENTITY_KIND(Builtin) \ + ENTITY_KIND(Alias) \ ENTITY_KIND(ImportName) \ ENTITY_KIND(LibraryName) \ ENTITY_KIND(Nil) \ @@ -108,6 +109,9 @@ struct Entity { struct { i32 id; } Builtin; + struct { + Entity *base; + } Alias; struct { String path; String name; @@ -232,6 +236,12 @@ Entity *make_entity_builtin(gbAllocator a, Scope *scope, Token token, Type *type return entity; } +Entity *make_entity_alias(gbAllocator a, Scope *scope, Token token, Type *type, Entity *base) { + Entity *entity = alloc_entity(a, Entity_Alias, scope, token, type); + entity->Alias.base = base; + return entity; +} + Entity *make_entity_import_name(gbAllocator a, Scope *scope, Token token, Type *type, String path, String name, Scope *import_scope) { Entity *entity = alloc_entity(a, Entity_ImportName, scope, token, type); -- cgit v1.2.3