Using arena as token array, remove arenas idea

This commit is contained in:
Krzosa Karol
2023-02-09 12:36:36 +01:00
parent 5138ba0097
commit 7370e8b716
16 changed files with 295 additions and 407 deletions

View File

@@ -44,7 +44,7 @@ string_scope_name(Allocator *a, Ast_Scope *scope){
CORE_Static void
gen_scope_name(Ast_Scope *scope){
Scratch_Arena *scratch = pctx->scratch;
Arena *scratch = pctx->scratch;
Scratch_Scope _scope(scratch);
String string = string_scope_name(scratch, scope);
gen("%.*s", (int)string.len, string.str);
@@ -169,7 +169,7 @@ string_simple_decl(Allocator *a, Ast_Type *ast, Intern_String name = {}){
CORE_Static void
gen_simple_decl(Ast_Type *ast, Intern_String name = {}){
Scratch_Arena *scratch = pctx->scratch;
Arena *scratch = pctx->scratch;
Scratch_Scope _scope(scratch);
String string = string_simple_decl(scratch, ast, name);
@@ -205,7 +205,7 @@ gen_value(Token *pos, Value a){
switch(type->kind){
CASE_INT: {
Scratch_Arena *scratch = pctx->scratch;
Arena *scratch = pctx->scratch;
Scratch_Scope _scope(scratch);
String postfix = get_type_postfix(type);
@@ -531,7 +531,7 @@ gen_ast(Ast *ast){
CASE(RETURN, Return){
if(is_tuple(node->resolved_type)) {
Scratch_Arena *scratch = pctx->scratch;
Arena *scratch = pctx->scratch;
Scratch_Scope _scope(scratch);
Intern_String var_name = pctx->intern(unique_name_scratch(scratch, node));
@@ -742,7 +742,7 @@ gen_ast(Ast *ast){
For(node->vars)
gen_ast(it);
Scratch_Arena *scratch = pctx->scratch;
Arena *scratch = pctx->scratch;
Scratch_Scope _scope(scratch);
Intern_String var_name = pctx->intern(unique_name_scratch(scratch, node));
@@ -844,7 +844,7 @@ typedef struct String{
// Generate slice and tuple types
For_Named(pctx->all_types, type){
Scratch_Arena *scratch = pctx->scratch;
Arena *scratch = pctx->scratch;
Scratch_Scope _scope(scratch);
if(type->kind == TYPE_SLICE){