From 2323ca6c9ec3c8ee76b9acf13745b80b92952a6a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 18 Mar 2019 23:47:45 +0100 Subject: Add struct, import caching, binop ops etc --- include/compiler.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include/compiler.h') diff --git a/include/compiler.h b/include/compiler.h index 32a5eab..47d4471 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -7,6 +7,7 @@ #include "std/scoped_allocator.h" #include "std/thread.h" #include "defs.h" +#include "ast.h" #define AMAL_COMPILER_OK 0 /* General error */ @@ -14,9 +15,10 @@ struct amal_compiler { ScopedAllocator allocator; - ScopedAllocator main_thread_allocator; + Scope root_scope; Buffer/**/ parsers; - Buffer queued_files; + Buffer/**/ queued_files; + HashMap/**/ file_scopes; ParserThreadData *threads; int usable_thread_count; bool started; @@ -26,8 +28,11 @@ struct amal_compiler { CHECK_RESULT int amal_compiler_init(amal_compiler *self); CHECK_RESULT int amal_compiler_deinit(amal_compiler *self); -/* Not thread-safe */ -CHECK_RESULT int amal_compiler_load_file(amal_compiler *self, BufferView filepath); +/* +This function creates a copy of @filepath in the same thread it's called from +so it doesn't have to survive longer than this function call. +*/ +CHECK_RESULT int amal_compiler_load_file(amal_compiler *self, const char *filepath, FileScopeReference **file_scope); /* TODO: amal_compiler_unload_file */ #endif -- cgit v1.2.3-70-g09d2