Rewriting types into ints at typechecking phase

This commit is contained in:
Krzosa Karol
2022-06-19 16:01:58 +02:00
parent 69fe514485
commit 02743c86d8
4 changed files with 54 additions and 19 deletions

View File

@@ -825,19 +825,17 @@ typedef struct String{
}
}
Scratch scratch;
for(S64 i = 0; i < pctx->type_map.cap; i++){
Map_Key_Value *it = pctx->type_map.data + i;
if(!it->occupied) continue;
Ast_Type *type = (Ast_Type *)it->value;
For(pctx->all_types){
Scratch scratch;
Ast_Type *type = it;
if(type->kind == TYPE_SLICE){
genln("typedef struct Slice%llu{", type->type_id);
global_indent++;
genln("S64 len;");
genln("");
gen_simple_decl(type->base);
gen(" data;");
gen_simple_decl(type_pointer(type->base), pctx->intern("data"_s));
gen(";");
global_indent--;
genln("} Slice%llu;", type->type_id);
}