*_of as keyords; Allow constant aliasing for user/built-in procedures, import names, and library names

This commit is contained in:
Ginger Bill
2017-07-04 11:23:48 +01:00
parent bc16b290ba
commit 689a0c0b49
9 changed files with 232 additions and 49 deletions

View File

@@ -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);