aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ast.h
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-29 22:20:36 +0900
committernsfisis <nsfisis@gmail.com>2025-08-29 22:48:12 +0900
commit34181f22cd6cec033a3136a7eb3c363c9e56d449 (patch)
tree5848fefd9c42e1c436bd1519a329ee61a7deaecf /src/ast.h
parent7ee8c2d11443e2531a6c701e59117204f453796f (diff)
downloadducc-34181f22cd6cec033a3136a7eb3c363c9e56d449.tar.gz
ducc-34181f22cd6cec033a3136a7eb3c363c9e56d449.tar.zst
ducc-34181f22cd6cec033a3136a7eb3c363c9e56d449.zip
fix: dangling pointer
Diffstat (limited to 'src/ast.h')
-rw-r--r--src/ast.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ast.h b/src/ast.h
index 8940aee..108d436 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -22,13 +22,20 @@ typedef enum TypeKind TypeKind;
const char* type_kind_stringify(TypeKind k);
struct AstNode;
+typedef struct AstNode AstNode;
+
+struct TypeRef {
+ struct AstNode* defs;
+ size_t index;
+};
+typedef struct TypeRef TypeRef;
struct Type {
TypeKind kind;
// Check `base` instead of `kind` to test if the type is an array or a pointer.
struct Type* base;
int array_size;
- struct AstNode* def;
+ TypeRef ref;
BOOL is_static;
};
typedef struct Type Type;
@@ -131,7 +138,6 @@ struct AstNode {
int __i1;
int __i2;
};
-typedef struct AstNode AstNode;
struct Program {
AstNode* funcs;