From 268491b224ac07edc50d314c071b19970cf157d0 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 9 Jun 2018 19:53:06 +0100 Subject: Use global arena for AstNode allocations --- src/check_type.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 7151c9b6f..e4bd3dd2b 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -208,9 +208,7 @@ void add_polymorphic_struct_entity(CheckerContext *ctx, AstNode *node, Type *nam token.kind = Token_String; token.string = named_type->Named.name; - AstNode *node = gb_alloc_item(a, AstNode); - node->kind = AstNode_Ident; - node->Ident.token = token; + AstNode *node = ast_ident(nullptr, token); e = alloc_entity_type_name(s, token, named_type); e->state = EntityState_Resolved; @@ -1634,8 +1632,7 @@ void init_map_entry_type(Type *type) { value: Value; } */ - AstNode *dummy_node = gb_alloc_item(a, AstNode); - dummy_node->kind = AstNode_Invalid; + AstNode *dummy_node = alloc_ast_node(nullptr, AstNode_Invalid); Scope *s = create_scope(universal_scope, a); auto fields = array_make(a, 0, 3); @@ -1670,8 +1667,7 @@ void init_map_internal_types(Type *type) { } */ gbAllocator a = heap_allocator(); - AstNode *dummy_node = gb_alloc_item(a, AstNode); - dummy_node->kind = AstNode_Invalid; + AstNode *dummy_node = alloc_ast_node(nullptr, AstNode_Invalid); Scope *s = create_scope(universal_scope, a); Type *hashes_type = alloc_type_dynamic_array(t_int); -- cgit v1.2.3