diff options
Diffstat (limited to 'src/checker/entity.cpp')
| -rw-r--r-- | src/checker/entity.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/checker/entity.cpp b/src/checker/entity.cpp index de4095766..8667aa0c7 100644 --- a/src/checker/entity.cpp +++ b/src/checker/entity.cpp @@ -6,6 +6,7 @@ enum BuiltinProcId; ENTITY_KIND(Invalid), \ ENTITY_KIND(Constant), \ ENTITY_KIND(Variable), \ + ENTITY_KIND(UsingVariable), \ ENTITY_KIND(TypeName), \ ENTITY_KIND(Procedure), \ ENTITY_KIND(Builtin), \ @@ -35,6 +36,7 @@ struct Entity { Token token; Type *type; Entity *using_parent; + AstNode *using_expr; union { struct { ExactValue value; } Constant; @@ -44,9 +46,9 @@ struct Entity { b8 is_field; // Is struct field b8 anonymous; // Variable is an anonymous } Variable; - struct { - b8 used; - } Procedure; + struct {} UsingVariable; + struct {} TypeName; + struct { b8 used; } Procedure; struct { BuiltinProcId id; } Builtin; }; }; @@ -72,6 +74,14 @@ Entity *make_entity_variable(gbAllocator a, Scope *scope, Token token, Type *typ return entity; } +Entity *make_entity_using_variable(gbAllocator a, Entity *parent, Token token, Type *type) { + GB_ASSERT(parent != NULL); + Entity *entity = alloc_entity(a, Entity_UsingVariable, parent->scope, token, type); + entity->using_parent = parent; + return entity; +} + + Entity *make_entity_constant(gbAllocator a, Scope *scope, Token token, Type *type, ExactValue value) { Entity *entity = alloc_entity(a, Entity_Constant, scope, token, type); entity->Constant.value = value; |