using on struct/union fields

This commit is contained in:
Ginger Bill
2016-08-24 23:25:56 +01:00
parent 6bd898e552
commit d2c64be85c
11 changed files with 461 additions and 189 deletions
+6 -4
View File
@@ -38,9 +38,10 @@ struct Entity {
union {
struct { ExactValue value; } Constant;
struct {
b8 visited;
b8 is_field;
b8 used;
b8 visited; // Cycle detection
b8 is_field; // Is struct field
b8 used; // Variable is used
b8 anonymous; // Variable is an anonymous struct field
} Variable;
struct { b8 used; } Procedure;
struct { BuiltinProcId id; } Builtin;
@@ -85,9 +86,10 @@ Entity *make_entity_param(gbAllocator a, Scope *parent, Token token, Type *type)
return entity;
}
Entity *make_entity_field(gbAllocator a, Scope *parent, Token token, Type *type) {
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->Variable.is_field = true;
entity->Variable.anonymous = cast(b8)is_anonymous;
return entity;
}