diff options
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index e1f21f459..f72d8a73c 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1196,7 +1196,7 @@ CommentGroup *consume_comment_group(AstFile *f, isize n, isize *end_line_) { CommentGroup *comments = nullptr; if (list.count > 0) { - comments = gb_alloc_item(heap_allocator(), CommentGroup); + comments = gb_alloc_item(permanent_allocator(), CommentGroup); comments->list = slice_from_array(list); array_add(&f->comments, comments); } @@ -4645,7 +4645,8 @@ ParseFileError init_ast_file(AstFile *f, String fullpath, TokenPos *err_pos) { zero_item(&f->tokenizer); f->tokenizer.curr_file_id = f->id; - TokenizerInitError err = init_tokenizer_from_fullpath(&f->tokenizer, f->fullpath); + bool copy_file_contents = build_context.command_kind == Command_strip_semicolon; + TokenizerInitError err = init_tokenizer_from_fullpath(&f->tokenizer, f->fullpath, copy_file_contents); if (err != TokenizerInit_None) { switch (err) { case TokenizerInit_Empty: @@ -4710,9 +4711,6 @@ ParseFileError init_ast_file(AstFile *f, String fullpath, TokenPos *err_pos) { block_size = ((block_size + page_size-1)/page_size) * page_size; block_size = gb_clamp(block_size, page_size, DEFAULT_MINIMUM_BLOCK_SIZE); f->arena.minimum_block_size = block_size; - #if 0 - arena_init_local_mutex(&f->arena); - #endif array_init(&f->comments, heap_allocator(), 0, 0); array_init(&f->imports, heap_allocator(), 0, 0); @@ -4727,8 +4725,6 @@ void destroy_ast_file(AstFile *f) { array_free(&f->tokens); array_free(&f->comments); array_free(&f->imports); - gb_free(heap_allocator(), f->tokenizer.fullpath.text); - destroy_tokenizer(&f->tokenizer); } bool init_parser(Parser *p) { @@ -4795,7 +4791,7 @@ WORKER_TASK_PROC(parser_worker_proc) { void parser_add_file_to_process(Parser *p, AstPackage *pkg, FileInfo fi, TokenPos pos) { // TODO(bill): Use a better allocator ImportedFile f = {pkg, fi, pos, p->file_to_process_count++}; - auto wd = gb_alloc_item(heap_allocator(), ParserWorkerData); + auto wd = gb_alloc_item(permanent_allocator(), ParserWorkerData); wd->parser = p; wd->imported_file = f; global_thread_pool_add_task(parser_worker_proc, wd); @@ -4833,7 +4829,7 @@ WORKER_TASK_PROC(foreign_file_worker_proc) { void parser_add_foreign_file_to_process(Parser *p, AstPackage *pkg, AstForeignFileKind kind, FileInfo fi, TokenPos pos) { // TODO(bill): Use a better allocator ImportedFile f = {pkg, fi, pos, p->file_to_process_count++}; - auto wd = gb_alloc_item(heap_allocator(), ForeignFileWorkerData); + auto wd = gb_alloc_item(permanent_allocator(), ForeignFileWorkerData); wd->parser = p; wd->imported_file = f; wd->foreign_kind = kind; @@ -4854,7 +4850,7 @@ AstPackage *try_add_import_path(Parser *p, String const &path, String const &rel string_set_add(&p->imported_files, path); - AstPackage *pkg = gb_alloc_item(heap_allocator(), AstPackage); + AstPackage *pkg = gb_alloc_item(permanent_allocator(), AstPackage); pkg->kind = kind; pkg->fullpath = path; array_init(&pkg->files, heap_allocator()); |