mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-29 16:51:49 -07:00
Add branch labels for loops; using list
This commit is contained in:
+15
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user