From 0f26e1d204d3a3026ca3edfc4c6bd9638b2632e7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 31 Jul 2019 22:29:24 +0200 Subject: Add nullable, add bytecode documentation --- include/ast.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'include/ast.h') 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_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 -- cgit v1.2.3