Removing heap allocations, Porting to Unix

This commit is contained in:
Krzosa Karol
2022-10-09 10:34:23 +02:00
parent aa2b4d90e4
commit b22e1ac0db
13 changed files with 260 additions and 269 deletions

View File

@@ -37,7 +37,7 @@ function String
string_scope_name(Allocator *a, Ast_Scope *scope){
String string = {};
if(scope->parent_scope) string = string_scope_name(a, scope->parent_scope);
assert_msg(scope->scope_id != 0, "Scope id is equal to 0 which is invalid, scope didn't initialize id");
assert_message(scope->scope_id != 0, "Scope id is equal to 0 which is invalid, scope didn't initialize id");
string = string_fmt(a, "%QS%u_", string, scope->scope_id);
return string;
}
@@ -673,9 +673,9 @@ gen_ast(Ast *ast){
gen("%Q{", node->unique_name);
global_indent++;
is_inside_struct++;
For(node->scope->decls){
Iter(&node->scope->decls){
genln("");
gen_ast(it);
gen_ast(it.item[0]);
}
is_inside_struct--;
@@ -688,10 +688,10 @@ gen_ast(Ast *ast){
gen("/*enum %Q{", node->name);
// @todo add typespec
global_indent++;
For(node->scope->decls){
genln("%Q", it->name);
Iter(&node->scope->decls){
genln("%Q", it.item[0]->name);
gen(" = ");
gen_value(it->pos, it->value);
gen_value(it.item[0]->pos, it.item[0]->value);
gen(",");
}
global_indent--;