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

@@ -806,8 +806,6 @@ static scc_ast_expr_t *parse_postfix_expression(scc_parser_t *parser) {
return null;
}
const char *name = scc_cstring_as_cstr(&ident_tok.lexeme);
scc_lexer_tok_drop(&ident_tok);
scc_ast_expr_t *member = expr_create(
parser, op_tok.type == SCC_TOK_DOT ? SCC_AST_EXPR_MEMBER
: SCC_AST_EXPR_PTR_MEMBER);