From f3a1ea57244608c1795e7f90cb3077c6a01686a9 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 3 Sep 2025 20:27:16 +0900 Subject: feat: rewrite function declaration parsing --- src/ast.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index 00b0171..f5fc98f 100644 --- a/src/ast.h +++ b/src/ast.h @@ -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; -- cgit v1.2.3-70-g09d2