This commit is contained in:
Krzosa Karol
2022-05-07 15:48:53 +02:00
parent d3ede16bab
commit 042127239e
11 changed files with 629 additions and 266 deletions

View File

@@ -202,19 +202,32 @@ decl_print(Decl *node){
}
} break;
case DECL_Const:
case DECL_Variable:{
println("%s: ", node->name.s.str);
B32 r = typespec_print(node->var_decl.type);
if(node->var_decl.typespec) typespec_print(node->var_decl.typespec);
print_assign_expr(node->var_decl.expr);
if(r) printf(";");
} break;
case DECL_Typedef:{
println("typedef %s ", node->name.s.str);
typespec_print(node->typedef_decl.type);
typespec_print(node->typedef_decl.typespec);
printf(";");
} break;
case DECL_Function:{
println("");
typespec_print(node->func_decl.ret);
printf(" %s", node->name.s.str);
printf("(");
for(Decl_Function_Arg *arg = node->func_decl.first; arg; arg=arg->next){
printf("%s: ", arg->name.s.str);
typespec_print(arg->typespec);
if(arg != node->func_decl.last)
printf(", ");
}
printf(");");
} break;
case DECL_Struct:
case DECL_Union :{