diff options
| author | Chris Heyes <rumcode@icloud.com> | 2019-11-01 19:18:33 +0000 |
|---|---|---|
| committer | Chris Heyes <rumcode@icloud.com> | 2019-11-01 19:18:33 +0000 |
| commit | 153e7525b5d64f12deb318d50aee1d9dbeb1fc8e (patch) | |
| tree | b8ac88c0788af31bcb3c5041d78306c2120714f6 /src/entity.cpp | |
| parent | d85893954dccc7833e3d954db641d9fd2a3c7451 (diff) | |
| parent | 44a303e5778fb8564964d53523634f34f8589489 (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/entity.cpp')
| -rw-r--r-- | src/entity.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/entity.cpp b/src/entity.cpp index 3318eac24..bbea68e8b 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -48,7 +48,8 @@ enum EntityFlag { EntityFlag_NotExported = 1<<14, EntityFlag_Static = 1<<16, - // EntityFlag_Reference = 1<<17, + + EntityFlag_ImplicitReference = 1<<17, // NOTE(bill): equivalent to `const &` in C++ EntityFlag_CVarArg = 1<<20, EntityFlag_AutoCast = 1<<21, @@ -183,10 +184,11 @@ bool is_entity_exported(Entity *e, bool allow_builtin = false) { } String name = e->token.string; - if (name.len == 0) { - return false; + switch (name.len) { + case 0: return false; + case 1: return name[0] != '_'; } - return name[0] != '_'; + return true; } bool entity_has_deferred_procedure(Entity *e) { @@ -219,12 +221,13 @@ Entity *alloc_entity_variable(Scope *scope, Token token, Type *type, bool is_imm return entity; } -Entity *alloc_entity_using_variable(Entity *parent, Token token, Type *type) { +Entity *alloc_entity_using_variable(Entity *parent, Token token, Type *type, Ast *using_expr) { GB_ASSERT(parent != nullptr); token.pos = parent->token.pos; Entity *entity = alloc_entity(Entity_Variable, parent->scope, token, type); entity->using_parent = parent; entity->parent_proc_decl = parent->parent_proc_decl; + entity->using_expr = using_expr; entity->flags |= EntityFlag_Using; entity->flags |= EntityFlag_Used; entity->state = EntityState_Resolved; |