Replacing core allocation stuff, still need to rewrite map and token

structures
This commit is contained in:
Krzosa Karol
2022-10-10 00:05:38 +02:00
parent 13f2f20ea6
commit 2f153a7cd3
9 changed files with 43 additions and 36 deletions

View File

@@ -293,7 +293,7 @@ struct Ast_Decl: Ast{
// AST Constructors beginning with expressions
//-----------------------------------------------------------------------------
#define AST_NEW(T,ikind,ipos,iflags) \
Ast_##T *result = exp_alloc_type(pctx->perm, Ast_##T, AF_ZeroMemory);\
Ast_##T *result = arena_push_type(pctx->perm, Ast_##T, AF_ZeroMemory);\
result->flags = iflags; \
result->kind = AST_##ikind; \
result->parent_scope = pctx->currently_parsed_scope; \
@@ -303,7 +303,7 @@ struct Ast_Decl: Ast{
#define ast_new(T,kind,pos,flags) (T *)_ast_new(sizeof(T), kind, pos, flags)
function Ast *
_ast_new(size_t size, Ast_Kind kind, Token *pos, Ast_Flag flags = 0){
Ast *result = (Ast *)exp_alloc(pctx->perm, size, AF_ZeroMemory);
Ast *result = (Ast *)arena_push_size(pctx->perm, size, AF_ZeroMemory);
result->flags = flags;
result->kind = kind;
result->parent_scope = pctx->currently_parsed_scope;
@@ -487,7 +487,7 @@ finalize_decl_scope(Ast_Scope *scope){
}
function Ast_Scope *
begin_stmt_scope(Allocator *scratch, Token *pos){
begin_stmt_scope(Arena *scratch, Token *pos){
AST_NEW(Scope, SCOPE, pos, AST_STMT);
result->stmts = {scratch};
result->file = pctx->currently_parsed_file;