aboutsummaryrefslogtreecommitdiff
path: root/src/entity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/entity.cpp')
-rw-r--r--src/entity.cpp16
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;