aboutsummaryrefslogtreecommitdiff
path: root/src/entity.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-03-19 16:59:11 +0000
committerGinger Bill <bill@gingerbill.org>2017-03-19 16:59:11 +0000
commit5562364a98f01a0c0221a70345656d45de0d2009 (patch)
tree3ea4409ec3fcd1b7469c96d0e6ff03b437f8f823 /src/entity.c
parent32150e401e39bd68f9882c3983829e744603dac1 (diff)
Add branch labels for loops; using list
Diffstat (limited to 'src/entity.c')
-rw-r--r--src/entity.c16
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);