Add typedefs in codegen, globals is working

This commit is contained in:
Krzosa Karol
2022-05-27 15:00:45 +02:00
parent 46abf8c1a6
commit 8875b61970
6 changed files with 92 additions and 122 deletions

View File

@@ -277,8 +277,12 @@ gen_ast(Ast *ast){
else if(sym->type == type_string){
gen("String %s = LIT(\"%s\");", node->name.str, sym->intern_val.str);
}
else if(sym->type == type_type){
gen("typedef ");
gen_simple_decl(sym->type_val, node->name);
}
else{
parsing_error(node->pos, "Unhandled type of constant expression");
parsing_error(node->pos, "C_Codegen: Unhandled type of constant expression");
}
Ast_End();