diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-03 20:27:16 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-03 20:27:16 +0900 |
| commit | f3a1ea57244608c1795e7f90cb3077c6a01686a9 (patch) | |
| tree | bfa3d91dd15d5d42043c2ed8fbd717614931d748 /src/ast.h | |
| parent | 5541c597cb68f76d1fc53e01b931eb870856843c (diff) | |
| download | ducc-f3a1ea57244608c1795e7f90cb3077c6a01686a9.tar.gz ducc-f3a1ea57244608c1795e7f90cb3077c6a01686a9.tar.zst ducc-f3a1ea57244608c1795e7f90cb3077c6a01686a9.zip | |
feat: rewrite function declaration parsing
Diffstat (limited to 'src/ast.h')
| -rw-r--r-- | src/ast.h | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -37,6 +37,7 @@ typedef enum { TypeKind_enum, TypeKind_ptr, TypeKind_array, + TypeKind_func, } TypeKind; const char* type_kind_stringify(TypeKind k); @@ -45,7 +46,7 @@ struct AstNode; typedef struct AstNode AstNode; typedef struct { - struct AstNode* defs; + AstNode* defs; size_t index; } TypeRef; @@ -56,6 +57,8 @@ typedef struct Type { struct Type* base; int array_size; TypeRef ref; + struct Type* result; + AstNode* params; } Type; Type* type_new(TypeKind kind); @@ -63,6 +66,7 @@ Type* type_new_ptr(Type* base); Type* type_new_array(Type* elem, int size); Type* type_new_static_string(int len); Type* type_array_to_ptr(Type* ty); +Type* type_new_func(Type* result, AstNode* params); BOOL type_is_unsized(Type* ty); int type_sizeof_struct(Type* ty); @@ -141,7 +145,6 @@ typedef enum { #define node_op __i1 #define node_stack_offset __i1 #define node_stack_size __i1 -#define node_function_is_static __i2 struct AstNode { AstNodeKind kind; |
