refactor(ast): 调整AST结构体和枚举类型的声明表示方式

将结构体、联合和枚举类型的字段表示从向量改为声明指针,
允许name和decl字段为null,更新相关初始化函数的断言检查,
使结构更加灵活并支持不完整类型定义。

BREAKING CHANGE: 修改了scc_ast_type结构体中record和enumeration
子类型的字段表示方法,从fields向量改为decl指针。
This commit is contained in:
zzy
2026-03-11 21:53:19 +08:00
parent ce5414f2eb
commit e6511c508c
12 changed files with 338 additions and 116 deletions

View File

@@ -181,11 +181,11 @@ struct scc_ast_type {
} function;
struct {
const char *name;
scc_ast_decl_vec_t fields; // 结构体/联合字段
scc_ast_decl_t *decl; // can be null
} record;
struct {
const char *name;
scc_ast_expr_vec_t enumerators; // 枚举项
scc_ast_decl_t *decl; // can be null
} enumeration;
struct {
const char *name;