diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-09-07 14:03:17 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-09-07 14:03:17 +0100 |
| commit | 61fcfd6f3d3c6cffd7e610abab83445b4cd1950d (patch) | |
| tree | f61e6d7be5f13c79ab3d98c76fcb836901b3c25e /src/checker/checker.cpp | |
| parent | 455820fc8438ab72c963ef354b9e32f6e5af1e65 (diff) | |
Begin Type_Info
Missing stuff in records, procedures, and tuples
Diffstat (limited to 'src/checker/checker.cpp')
| -rw-r--r-- | src/checker/checker.cpp | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/src/checker/checker.cpp b/src/checker/checker.cpp index 04b68eb9b..94917d7c7 100644 --- a/src/checker/checker.cpp +++ b/src/checker/checker.cpp @@ -150,6 +150,8 @@ enum BuiltinProcId { BuiltinProc_max, BuiltinProc_abs, + BuiltinProc_type_info, + BuiltinProc_Count, }; struct BuiltinProc { @@ -188,6 +190,8 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_Count] = { {STR_LIT("min"), 2, false, Expr_Expr}, {STR_LIT("max"), 2, false, Expr_Expr}, {STR_LIT("abs"), 1, false, Expr_Expr}, + + {STR_LIT("type_info"), 1, false, Expr_Expr}, }; struct CheckerContext { @@ -197,13 +201,14 @@ struct CheckerContext { // NOTE(bill): Symbol tables struct CheckerInfo { - Map<TypeAndValue> types; // Key: AstNode * | Expression -> Type (and value) - Map<Entity *> definitions; // Key: AstNode * | Identifier -> Entity - Map<Entity *> uses; // Key: AstNode * | Identifier -> Entity - Map<Scope *> scopes; // Key: AstNode * | Node -> Scope - Map<ExpressionInfo> untyped; // Key: AstNode * | Expression -> ExpressionInfo - Map<DeclInfo *> entities; // Key: Entity * - Map<Entity *> foreign_procs; // Key: String + Map<TypeAndValue> types; // Key: AstNode * | Expression -> Type (and value) + Map<Entity *> definitions; // Key: AstNode * | Identifier -> Entity + Map<Entity *> uses; // Key: AstNode * | Identifier -> Entity + Map<Scope *> scopes; // Key: AstNode * | Node -> Scope + Map<ExpressionInfo> untyped; // Key: AstNode * | Expression -> ExpressionInfo + Map<DeclInfo *> entities; // Key: Entity * + Map<Entity *> foreign_procs; // Key: String + Map<Type *> type_info_types; // Key: Type * }; struct Checker { @@ -383,6 +388,26 @@ void add_global_constant(gbAllocator a, String name, Type *type, ExactValue valu add_global_entity(entity); } + +Type *t_type_info = NULL; +Type *t_type_info_ptr = NULL; + +Type *t_type_info_named = NULL; +Type *t_type_info_integer = NULL; +Type *t_type_info_float = NULL; +Type *t_type_info_string = NULL; +Type *t_type_info_boolean = NULL; +Type *t_type_info_pointer = NULL; +Type *t_type_info_procedure = NULL; +Type *t_type_info_array = NULL; +Type *t_type_info_slice = NULL; +Type *t_type_info_vector = NULL; +Type *t_type_info_struct = NULL; +Type *t_type_info_union = NULL; +Type *t_type_info_raw_union = NULL; +Type *t_type_info_enum = NULL; + + void init_universal_scope(void) { // NOTE(bill): No need to free these gbAllocator a = gb_heap_allocator(); @@ -425,13 +450,14 @@ 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->foreign_procs, 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); + map_init(&i->type_info_types, a); } @@ -443,6 +469,7 @@ void destroy_checker_info(CheckerInfo *i) { map_destroy(&i->entities); map_destroy(&i->untyped); map_destroy(&i->foreign_procs); + map_destroy(&i->type_info_types); } |