diff options
| author | gingerBill <bill@gingerbill.org> | 2018-05-26 23:12:55 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-05-26 23:12:55 +0100 |
| commit | c067b90403ab8493daa0bf5867b2bd92319feea5 (patch) | |
| tree | f8d8162cc7d0e937c925ed8b07831ffc0e9c75de /src/entity.cpp | |
| parent | 5b6770f3d297c0639bdbe8b1b029616c16669165 (diff) | |
Add basic package support (no IR support yet)
Diffstat (limited to 'src/entity.cpp')
| -rw-r--r-- | src/entity.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/entity.cpp b/src/entity.cpp index 182df8c05..d7f7dc2df 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -6,6 +6,7 @@ struct DeclInfo; #define ENTITY_KINDS \ ENTITY_KIND(Invalid) \ + ENTITY_KIND(Package) \ ENTITY_KIND(Constant) \ ENTITY_KIND(Variable) \ ENTITY_KIND(TypeName) \ @@ -86,6 +87,12 @@ struct Entity { union { struct { + String fullpath; + String name; + Scope *scope; + // Array<Entity *> imports; // Entity_Package + } Package; + struct { ExactValue value; } Constant; struct { @@ -189,6 +196,15 @@ Entity *alloc_entity(EntityKind kind, Scope *scope, Token token, Type *type) { return entity; } +Entity *alloc_entity_package(Scope *scope, Type *type, String fullpath, String name) { + Token token = empty_token; + token.string = name; + Entity *entity = alloc_entity(Entity_Package, scope, token, type); + entity->Package.fullpath = fullpath; + entity->Package.name = name; + return entity; +} + Entity *alloc_entity_variable(Scope *scope, Token token, Type *type, bool is_immutable, EntityState state = EntityState_Unresolved) { Entity *entity = alloc_entity(Entity_Variable, scope, token, type); entity->Variable.is_immutable = is_immutable; |