Introduce the allocator stuff again

This commit is contained in:
Krzosa Karol
2022-12-31 16:51:01 +01:00
parent e20edaa3a2
commit 55515ff420
12 changed files with 71 additions and 44 deletions

View File

@@ -1,7 +1,7 @@
#define AST_NEW(T,ikind,ipos,iflags) \
Ast_##T *result = arena_push_type(pctx->perm, Ast_##T, AF_ZeroMemory);\
Ast_##T *result = allocate_struct(pctx->perm, Ast_##T); \
result->flags = iflags; \
result->kind = AST_##ikind; \
result->parent_scope = pctx->currently_parsed_scope; \
@@ -11,7 +11,7 @@
#define ast_new(T,kind,pos,flags) (T *)_ast_new(sizeof(T), kind, pos, flags)
CORE_Static Ast *
_ast_new(size_t size, Ast_Kind kind, Token *pos, Ast_Flag flags = 0){
Ast *result = (Ast *)arena_push_size(pctx->perm, size, AF_ZeroMemory);
Ast *result = (Ast *)allocate_size(pctx->perm, size);
result->flags = flags;
result->kind = kind;
result->parent_scope = pctx->currently_parsed_scope;