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

@@ -53,7 +53,7 @@ compiler_error(Token *token1, Token *token2, const char *str, ...){
if(token1) printf("\n%s:%d token_di:%u", token1->file.str, (S32)token1->line + 1, token1->di);
if(token2) printf("\n%s:%d token_di:%u", token2->file.str, (S32)token2->line + 1, token2->di);
__debugbreak();
Breakpoint;
}
function void
@@ -72,7 +72,7 @@ compiler_error(Token *token, const char *str, ...){
if(token) printf("\n%s:%d token_di:%u", token->file.str, (S32)token->line + 1, token->di);
__debugbreak();
Breakpoint;
}
function Token *
@@ -678,7 +678,7 @@ parse_struct(Token *pos){
Ast_Decl *decl = ast_var(token, typespec, token->intern_val, 0);
decl->flags = set_flag(decl->flags, AST_AGGREGATE_CHILD);
scope->decls.add(decl);
add(pctx->perm, &scope->decls, decl);
}while(token_match(SAME_SCOPE));
token_expect(CLOSE_SCOPE);
@@ -702,7 +702,7 @@ parse_enum(Token *pos){
if(token_match(TK_DoubleColon)) value = parse_expr();
Ast_Decl *member = ast_const(name, name->intern_val, value);
member->flags = set_flag(member->flags, AST_AGGREGATE_CHILD);
scope->decls.add(member);
add(pctx->perm, &scope->decls, member);
}while(token_match(SAME_SCOPE));
finalize_decl_scope(scope);
token_expect(CLOSE_SCOPE);
@@ -753,7 +753,6 @@ register_ast_file(Token *pos, String absolute_file_path, Ast_Module *module, B32
file->module = module;
file->parent_scope = 0;
file->file = file; // @warning: self referential!
file->decls = {pctx->heap};
file->pos = pos;
file->debug_name = string_skip_to_last_slash(absolute_file_path);
add(pctx->perm, &file->module->all_loaded_files, file);