@@ -84,9 +84,9 @@ func void *_parser_ast_push(struct context *context, struct token *token, smm si
8484
8585 struct ast * ast = push_struct_ (context -> arena , size , align ); // @note: No need to zero, 'arena' never has any non-zero bytes.
8686
87- ast -> kind = kind ;
88- ast -> s = get_unique_ast_serial ( context ) ;
89- ast -> token = token ;
87+ ast -> kind = kind ;
88+ ast -> token = token ;
89+ ast -> s = get_unique_ast_serial ( context ) ;
9090 ast -> byte_offset_in_function = -1 ;
9191
9292 return ast ;
@@ -98,16 +98,17 @@ func struct ast *invalid_ast(struct context *context){
9898 return invalid ;
9999}
100100
101- #define parser_type_push (context , token , type ) (struct ast_##type *)_parser_type_push(context, token,\
102- sizeof(struct ast_##type), alignof(struct ast_##type), AST_##type)
101+ #define parser_type_push (context , token , type ) (struct ast_##type *)_parser_type_push(context, token, sizeof(struct ast_##type), alignof(struct ast_##type), AST_##type)
102+
103103func struct ast_type * _parser_type_push (struct context * context , struct token * token , smm size , u32 align , enum ast_kind kind ){
104104 assert (token -> type != TOKEN_invalid );
105105
106- struct ast_type * type = push_struct_ (context -> arena , size , align );
107- memset ( type , 0 , size );
106+ struct ast_type * type = push_struct_ (context -> arena , size , align ); // @note: No need to zero, 'arena' never has any non-zero bytes.
107+
108108 type -> kind = kind ;
109109 type -> token = token ;
110110 type -> s = get_unique_ast_serial (context );
111+
111112 return type ;
112113}
113114
@@ -5058,7 +5059,7 @@ case NUMBER_KIND_##type:{ \
50585059 report_warning (context , WARNING_unsigned_negation , operand -> token , "Negation of an unsigned number is still unsigned." );
50595060 }
50605061
5061- // @note: This only flipps the top bit so signdedness does not matter .
5062+ // @note: Negation is the same of signed and unsigned values .
50625063 switch (lit -> base .resolved_type -> size ){
50635064 case 1 : lit -> _s8 = - lit -> _s8 ; break ;
50645065 case 2 : lit -> _s16 = - lit -> _s16 ; break ;
@@ -7596,7 +7597,7 @@ func struct declaration_list parse_declaration_list(struct context *context, str
75967597
75977598 // This is in arena, as we now have 'ast_declaration_list', maybe this is not necessary,
75987599 // as we dont use 'ast_declaration_list' at global scope. @leak @cleanup: Is this comment still accurate?
7599- struct declaration_node * node = push_struct (context -> arena , struct declaration_node );
7600+ struct declaration_node * node = push_uninitialized_struct (context -> arena , struct declaration_node );
76007601 node -> decl = decl ;
76017602 sll_push_back (ret , node );
76027603
0 commit comments