aboutsummaryrefslogtreecommitdiff
path: root/include/ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ast.h')
-rw-r--r--include/ast.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/ast.h b/include/ast.h
index 7b16796..25d9034 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -2,6 +2,7 @@
#define AMALGAM_AST_H
#include "defs.h"
+#include "std/defs.h"
#include "std/buffer_view.h"
#include "std/buffer.h"
#include "std/misc.h"
@@ -108,6 +109,13 @@ struct LhsExpr {
BufferView var_name;
Variable type;
Ast rhs_expr;
+ /*
+ A mutex is only available if the LhsExpr is public, because other threads (files)
+ can access it. It's used to prevent usage of unresolved data and also to decide which
+ thread has responsibility of resolving data.
+ TODO: Find a better way to store this. This most likely will use too much memory.
+ */
+ amal_mutex *mutex;
};
struct Import {
@@ -149,7 +157,7 @@ CHECK_RESULT int funcdecl_init(FunctionDecl *self, Scope *parent, ScopedAllocato
CHECK_RESULT int funccall_init(FunctionCall *self, BufferView name, ScopedAllocator *allocator);
CHECK_RESULT int structdecl_init(StructDecl *self, Scope *parent, ScopedAllocator *allocator);
void structfield_init(StructField *self, BufferView name, BufferView type_name);
-void lhsexpr_init(LhsExpr *self, bool is_pub, bool is_const, BufferView var_name);
+CHECK_RESULT int lhsexpr_init(LhsExpr *self, bool is_pub, bool is_const, BufferView var_name, ScopedAllocator *allocator);
void import_init(Import *self, BufferView path);
CHECK_RESULT int string_init(String *self, BufferView str);
void number_init(Number *self, i64 value, bool is_integer);