Ink: Change how many nodes we reserve in parser.

This commit is contained in:
2025-09-30 07:39:34 +02:00
parent 344d6b2d31
commit a4b5a7677b

View File

@@ -1473,9 +1473,9 @@ parse :: (ctx : *Compiler_Context, allocator := temp) {
push_context new_context { push_context new_context {
init_context_allocators(); init_context_allocators();
defer clear_context_allocators(); defer clear_context_allocators();
parse_state : Parser; parse_state : Parser;
array_reserve(*ctx.nodes, 4096); array_reserve(*ctx.nodes, 128); //@Note(niels): This is quite a random number to be honest
parse_state.current_token_index = 0; parse_state.current_token_index = 0;
parse_state.ctx = ctx; parse_state.ctx = ctx;
@@ -1483,7 +1483,6 @@ parse :: (ctx : *Compiler_Context, allocator := temp) {
if !match(*parse_state, .TOKEN_EOF) { if !match(*parse_state, .TOKEN_EOF) {
parse_state.ctx.root = make_node(*parse_state, .Program); parse_state.ctx.root = make_node(*parse_state, .Program);
array_reserve(*parse_state.ctx.root.children, 1024);
program := parse_state.ctx.root; program := parse_state.ctx.root;
while !check(*parse_state, .TOKEN_EOF) { while !check(*parse_state, .TOKEN_EOF) {