diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-08-29 22:20:36 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-08-29 22:48:12 +0900 |
| commit | 34181f22cd6cec033a3136a7eb3c363c9e56d449 (patch) | |
| tree | 5848fefd9c42e1c436bd1519a329ee61a7deaecf /src/ast.h | |
| parent | 7ee8c2d11443e2531a6c701e59117204f453796f (diff) | |
| download | ducc-34181f22cd6cec033a3136a7eb3c363c9e56d449.tar.gz ducc-34181f22cd6cec033a3136a7eb3c363c9e56d449.tar.zst ducc-34181f22cd6cec033a3136a7eb3c363c9e56d449.zip | |
fix: dangling pointer
Diffstat (limited to 'src/ast.h')
| -rw-r--r-- | src/ast.h | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; |
