From d2c64be85ca15117b1745b254b1806ea739aef43 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Wed, 24 Aug 2016 23:25:56 +0100 Subject: `using` on struct/union fields --- src/checker/entity.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/checker/entity.cpp') 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; } -- cgit v1.2.3