|
@@ -31,7 +31,7 @@ struct Entity {
|
|
|
EntityKind kind;
|
|
|
EntityGuid guid;
|
|
|
|
|
|
- Scope *parent;
|
|
|
+ Scope *scope;
|
|
|
Token token;
|
|
|
Type *type;
|
|
|
|
|
@@ -54,52 +54,52 @@ EntityGuid next_entity_guid(void) {
|
|
|
return cast(EntityGuid)gb_atomic64_fetch_add(&entity_guid_counter, 1);
|
|
|
}
|
|
|
|
|
|
-Entity *alloc_entity(gbAllocator a, EntityKind kind, Scope *parent, Token token, Type *type) {
|
|
|
+Entity *alloc_entity(gbAllocator a, EntityKind kind, Scope *scope, Token token, Type *type) {
|
|
|
Entity *entity = gb_alloc_item(a, Entity);
|
|
|
entity->kind = kind;
|
|
|
entity->guid = next_entity_guid();
|
|
|
- entity->parent = parent;
|
|
|
+ entity->scope = scope;
|
|
|
entity->token = token;
|
|
|
entity->type = type;
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
-Entity *make_entity_variable(gbAllocator a, Scope *parent, Token token, Type *type) {
|
|
|
- Entity *entity = alloc_entity(a, Entity_Variable, parent, token, type);
|
|
|
+Entity *make_entity_variable(gbAllocator a, Scope *scope, Token token, Type *type) {
|
|
|
+ Entity *entity = alloc_entity(a, Entity_Variable, scope, token, type);
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
-Entity *make_entity_constant(gbAllocator a, Scope *parent, Token token, Type *type, ExactValue value) {
|
|
|
- Entity *entity = alloc_entity(a, Entity_Constant, parent, token, type);
|
|
|
+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;
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
-Entity *make_entity_type_name(gbAllocator a, Scope *parent, Token token, Type *type) {
|
|
|
- Entity *entity = alloc_entity(a, Entity_TypeName, parent, token, type);
|
|
|
+Entity *make_entity_type_name(gbAllocator a, Scope *scope, Token token, Type *type) {
|
|
|
+ Entity *entity = alloc_entity(a, Entity_TypeName, scope, token, type);
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
-Entity *make_entity_param(gbAllocator a, Scope *parent, Token token, Type *type) {
|
|
|
- Entity *entity = make_entity_variable(a, parent, token, type);
|
|
|
+Entity *make_entity_param(gbAllocator a, Scope *scope, Token token, Type *type) {
|
|
|
+ Entity *entity = make_entity_variable(a, scope, token, type);
|
|
|
entity->Variable.used = true;
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
-Entity *make_entity_field(gbAllocator a, Scope *parent, Token token, Type *type, b32 is_anonymous) {
|
|
|
- Entity *entity = make_entity_variable(a, parent, token, type);
|
|
|
+Entity *make_entity_field(gbAllocator a, Scope *scope, Token token, Type *type, b32 is_anonymous) {
|
|
|
+ Entity *entity = make_entity_variable(a, scope, token, type);
|
|
|
entity->Variable.is_field = true;
|
|
|
entity->Variable.anonymous = cast(b8)is_anonymous;
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
-Entity *make_entity_procedure(gbAllocator a, Scope *parent, Token token, Type *signature_type) {
|
|
|
- Entity *entity = alloc_entity(a, Entity_Procedure, parent, token, signature_type);
|
|
|
+Entity *make_entity_procedure(gbAllocator a, Scope *scope, Token token, Type *signature_type) {
|
|
|
+ Entity *entity = alloc_entity(a, Entity_Procedure, scope, token, signature_type);
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
-Entity *make_entity_builtin(gbAllocator a, Scope *parent, Token token, Type *type, BuiltinProcId id) {
|
|
|
- Entity *entity = alloc_entity(a, Entity_Builtin, parent, token, type);
|
|
|
+Entity *make_entity_builtin(gbAllocator a, Scope *scope, Token token, Type *type, BuiltinProcId id) {
|
|
|
+ Entity *entity = alloc_entity(a, Entity_Builtin, scope, token, type);
|
|
|
entity->Builtin.id = id;
|
|
|
return entity;
|
|
|
}
|