diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-03-19 16:59:11 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-03-19 16:59:11 +0000 |
| commit | 5562364a98f01a0c0221a70345656d45de0d2009 (patch) | |
| tree | 3ea4409ec3fcd1b7469c96d0e6ff03b437f8f823 /src/entity.c | |
| parent | 32150e401e39bd68f9882c3983829e744603dac1 (diff) | |
Add branch labels for loops; using list
Diffstat (limited to 'src/entity.c')
| -rw-r--r-- | src/entity.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/entity.c b/src/entity.c index 446edfa54..aa1b8f52a 100644 --- a/src/entity.c +++ b/src/entity.c @@ -15,12 +15,13 @@ typedef struct Type Type; ENTITY_KIND(LibraryName) \ ENTITY_KIND(Alias) \ ENTITY_KIND(Nil) \ - ENTITY_KIND(Count) + ENTITY_KIND(Label) typedef enum EntityKind { #define ENTITY_KIND(k) GB_JOIN2(Entity_, k), ENTITY_KINDS #undef ENTITY_KIND + Entity_Count, } EntityKind; String const entity_strings[] = { @@ -100,6 +101,10 @@ struct Entity { Entity *original; } Alias; i32 Nil; + struct { + String name; + AstNode *node; + } Label; }; }; @@ -235,6 +240,15 @@ Entity *make_entity_nil(gbAllocator a, String name, Type *type) { return entity; } +Entity *make_entity_label(gbAllocator a, Scope *scope, Token token, Type *type, + AstNode *node) { + Entity *entity = alloc_entity(a, Entity_Label, scope, token, type); + entity->Label.node = node; + return entity; +} + + + Entity *make_entity_dummy_variable(gbAllocator a, Scope *scope, Token token) { token.string = str_lit("_"); return make_entity_variable(a, scope, token, NULL, false); |