aboutsummaryrefslogtreecommitdiff
path: root/src/checker/entity.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-08-24 23:25:56 +0100
committerGinger Bill <bill@gingerbill.org>2016-08-24 23:25:56 +0100
commitd2c64be85ca15117b1745b254b1806ea739aef43 (patch)
tree2f5192cfbff77a6eef55ddf1fe2f1269b403561a /src/checker/entity.cpp
parent6bd898e552392b1bd11ad16c7476833261c1d4b7 (diff)
`using` on struct/union fields
Diffstat (limited to 'src/checker/entity.cpp')
-rw-r--r--src/checker/entity.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/checker/entity.cpp b/src/checker/entity.cpp
index 272d028d0..b59481319 100644
--- a/src/checker/entity.cpp
+++ b/src/checker/entity.cpp
@@ -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;
}