diff options
Diffstat (limited to 'include/ast.h')
-rw-r--r-- | include/ast.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/include/ast.h b/include/ast.h index f056db7..4c54766 100644 --- a/include/ast.h +++ b/include/ast.h @@ -6,7 +6,7 @@ #include "std/buffer_view.h" #include "std/buffer.h" #include "std/misc.h" -#include "std/scoped_allocator.h" +#include "std/arena_allocator.h" #include "std/hash_map.h" #include "binop_type.h" #include "ssa/ssa.h" @@ -106,6 +106,7 @@ struct Variable { struct FunctionSignature { int params; /* TODO: Implement signatures */ + bool resolved; }; struct FunctionDecl { @@ -218,12 +219,13 @@ typedef struct { Scope *scope; } AstCompilerContext; -CHECK_RESULT int ast_create(ScopedAllocator *allocator, void *value, AstType type, Ast **result); +CHECK_RESULT int ast_create(ArenaAllocator *allocator, void *value, AstType type, Ast **result); BufferView ast_get_name(Ast *self); -CHECK_RESULT int funcdecl_init(FunctionDecl *self, FunctionSignature *signature, Scope *parent, ScopedAllocator *allocator); -CHECK_RESULT int funccall_init(FunctionCall *self, BufferView name, ScopedAllocator *allocator); -CHECK_RESULT int structdecl_init(StructDecl *self, Scope *parent, ScopedAllocator *allocator); +void function_signature_init(FunctionSignature *self); +CHECK_RESULT int funcdecl_init(FunctionDecl *self, FunctionSignature *signature, Scope *parent, ArenaAllocator *allocator); +CHECK_RESULT int funccall_init(FunctionCall *self, BufferView name, ArenaAllocator *allocator); +CHECK_RESULT int structdecl_init(StructDecl *self, Scope *parent, ArenaAllocator *allocator); void structfield_init(StructField *self, BufferView name, BufferView type_name); void lhsexpr_init(LhsExpr *self, bool is_extern, bool is_pub, bool is_const, BufferView var_name); void assignmentexpr_init(AssignmentExpr *self, Ast *lhs_expr, Ast *rhs_expr); @@ -232,12 +234,12 @@ CHECK_RESULT int string_init(String *self, BufferView str); void number_init(Number *self, i64 value, bool is_integer, BufferView code_ref); void variable_init(Variable *self, BufferView name); void binop_init(Binop *self); -CHECK_RESULT int if_statement_init(IfStatement *self, Scope *parent, ScopedAllocator *allocator); -CHECK_RESULT int else_if_statement_init(ElseIfStatement *self, Scope *parent, ScopedAllocator *allocator); -CHECK_RESULT int while_statement_init(WhileStatement *self, Scope *parent, ScopedAllocator *allocator); +CHECK_RESULT int if_statement_init(IfStatement *self, Scope *parent, ArenaAllocator *allocator); +CHECK_RESULT int else_if_statement_init(ElseIfStatement *self, Scope *parent, ArenaAllocator *allocator); +CHECK_RESULT int while_statement_init(WhileStatement *self, Scope *parent, ArenaAllocator *allocator); -CHECK_RESULT int scope_init(Scope *self, Scope *parent, ScopedAllocator *allocator); -CHECK_RESULT int file_scope_reference_init(FileScopeReference *self, BufferView canonical_path, ScopedAllocator *allocator); +CHECK_RESULT int scope_init(Scope *self, Scope *parent, ArenaAllocator *allocator); +CHECK_RESULT int file_scope_reference_init(FileScopeReference *self, BufferView canonical_path, ArenaAllocator *allocator); CHECK_RESULT int scope_add_child(Scope *self, Ast *child); /* longjump to compiler env on failure */ void scope_resolve(Scope *self, AstCompilerContext *context); |