aboutsummaryrefslogtreecommitdiff
path: root/include/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/compiler.h')
-rw-r--r--include/compiler.h13
1 files changed, 9 insertions, 4 deletions
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/*<Parser*>*/ parsers;
- Buffer queued_files;
+ Buffer/*<BufferView>*/ queued_files;
+ HashMap/*<BufferView, FileScopeReference*>*/ 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