refactor(ast): 将AST类型系统重构为规范类型系统
- 将scc_ast_type_t替换为scc_ast_qual_type_t,引入规范类型概念 - 添加scc_ast_canonical_type_t联合体用于表示规范类型 - 修改头文件结构,移除大量内联初始化函数,改为使用AST上下文分配器 - 添加SCC_AST_ALLOC宏用于统一节点分配管理 - 更新builtin类型枚举定义,添加类型计数常量 feat(ast): 引入AST上下文管理器 - 创建scc_ast_ctx_t结构体用于管理AST节点生命周期 - 实现类型池化机制,支持内置类型的统一管理 - 添加canonical类型获取和分配接口 refactor(abi): 适配新的AST类型系统 - 更新头文件包含,从<scc_ir.h>改为<scc_hir.h> - 适配函数参数类型,使用qual_type替代原始type - 使用scc_ast_canon_type()函数获取规范类型进行处理 Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#include <scc_ast.h>
|
||||
#include <scc_ir.h>
|
||||
#include <scc_hir.h>
|
||||
#include <scc_type_abi.h>
|
||||
|
||||
void scc_abi_compute_ast_type_layout(const scc_abi_type_calc_t *ctx, void *type,
|
||||
scc_abi_type_layout_t *layout) {
|
||||
scc_ast_type_t *ast_type = type;
|
||||
scc_ast_qual_type_t *ast_type = type;
|
||||
scc_abi_base_type_kind_t kind = SCC_ABI_TYPE_VOID;
|
||||
switch (ast_type->builtin.type) {
|
||||
switch (scc_ast_canon_type(ast_type)->builtin.type) {
|
||||
case SCC_AST_BUILTIN_TYPE_VOID:
|
||||
kind = SCC_ABI_TYPE_VOID;
|
||||
break;
|
||||
@@ -56,7 +56,8 @@ void scc_abi_compute_ast_type_layout(const scc_abi_type_calc_t *ctx, void *type,
|
||||
kind = SCC_ABI_TYPE_U_LONG_LONG;
|
||||
break;
|
||||
default:
|
||||
Panic("Unsupported AST type: %d", ast_type->builtin.type);
|
||||
Panic("Unsupported AST type: %d",
|
||||
scc_ast_canon_type(ast_type)->builtin.type);
|
||||
break;
|
||||
}
|
||||
scc_abi_get_base_type_layout(ctx->impls, kind, layout);
|
||||
|
||||
Reference in New Issue
Block a user