From c2e3c3801acd8af32fcf6ea3ad2d3a2ddc94c870 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sun, 4 Sep 2016 16:16:17 +0100 Subject: Type match statement for tagged unions --- src/checker/checker.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/checker/checker.cpp') diff --git a/src/checker/checker.cpp b/src/checker/checker.cpp index 8c95281fc..04b68eb9b 100644 --- a/src/checker/checker.cpp +++ b/src/checker/checker.cpp @@ -197,12 +197,13 @@ struct CheckerContext { // NOTE(bill): Symbol tables struct CheckerInfo { - Map types; // Key: AstNode * | Expression -> Type (and value) - Map definitions; // Key: AstNode * | Identifier -> Entity - Map uses; // Key: AstNode * | Identifier -> Entity - Map scopes; // Key: AstNode * | Node -> Scope - Map untyped; // Key: AstNode * | Expression -> ExpressionInfo - Map entities; // Key: Entity * + Map types; // Key: AstNode * | Expression -> Type (and value) + Map definitions; // Key: AstNode * | Identifier -> Entity + Map uses; // Key: AstNode * | Identifier -> Entity + Map scopes; // Key: AstNode * | Node -> Scope + Map untyped; // Key: AstNode * | Expression -> ExpressionInfo + Map entities; // Key: Entity * + Map foreign_procs; // Key: String }; struct Checker { @@ -424,12 +425,13 @@ void init_universal_scope(void) { void init_checker_info(CheckerInfo *i) { gbAllocator a = gb_heap_allocator(); - map_init(&i->types, a); - map_init(&i->definitions, a); - map_init(&i->uses, a); - map_init(&i->scopes, a); - map_init(&i->entities, a); - map_init(&i->untyped, a); + map_init(&i->types, a); + map_init(&i->definitions, a); + map_init(&i->uses, a); + map_init(&i->scopes, a); + map_init(&i->entities, a); + map_init(&i->untyped, a); + map_init(&i->foreign_procs, a); } @@ -440,6 +442,7 @@ void destroy_checker_info(CheckerInfo *i) { map_destroy(&i->scopes); map_destroy(&i->entities); map_destroy(&i->untyped); + map_destroy(&i->foreign_procs); } -- cgit v1.2.3