diff options
Diffstat (limited to 'include/ast.h')
-rw-r--r-- | include/ast.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/ast.h b/include/ast.h index 4c54766..6a40980 100644 --- a/include/ast.h +++ b/include/ast.h @@ -2,6 +2,7 @@ #define AMALGAM_AST_H #include "defs.h" +#include "nullable.h" #include "std/defs.h" #include "std/buffer_view.h" #include "std/buffer.h" @@ -17,6 +18,7 @@ #define AST_ERR -1 #define AST_ERR_DEF_DUP -20 +typedef struct Ast Ast; typedef struct FunctionSignature FunctionSignature; typedef struct FunctionCall FunctionCall; typedef struct StructDecl StructDecl; @@ -79,12 +81,14 @@ typedef struct { Parser *parser; /* Borrowed. This is the parser that is currently parsing the expression */ } AstResolveData; -typedef struct { +struct Ast { AstValue value; AstType type; AstResolveData resolve_data; SsaRegister ssa_reg; -} Ast; +}; + +DefineNullablePtrType(Ast); struct Scope { Buffer/*<Ast*>*/ ast_objects; @@ -156,7 +160,7 @@ struct LhsExpr { bool is_const; BufferView var_name; VariableType type; - Ast *rhs_expr; + NullablePtr(Ast) rhs_expr; }; struct AssignmentExpr { @@ -244,4 +248,8 @@ CHECK_RESULT int scope_add_child(Scope *self, Ast *child); /* longjump to compiler env on failure */ void scope_resolve(Scope *self, AstCompilerContext *context); + + +CHECK_RESULT bool resolved_type_is_func_decl(Ast *self); + #endif |