mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-16 19:02:23 -07:00
Better using; foreign system libraries; optional semicolons
This commit is contained in:
+13
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user