refactor(hashtable): 简化哈希表初始化接口并优化文件打开模式

- 将哈希表初始化从两步设置改为一步完成,直接传递哈希函数和比较函数
- 重构scc_hashtable_init函数签名,接受函数指针参数
- 更新内部字段名从key_cmp为cmp_func以保持一致性
- 添加类型定义scc_hashtable_hash_func_t和scc_hashtable_equal_func_t
- 修改PAL层文件操作接口,使用枚举模式替代固定只读模式
- 更新IR上下文、预处理器宏表等组件使用新的初始化方式
- 移除AST头文件中未使用的语义分析回调类型定义
- 修复预处理器中的空指针访问问题
This commit is contained in:
zzy
2026-03-04 16:47:28 +08:00
parent 2c4b803058
commit 4015acd866
10 changed files with 48 additions and 51 deletions

View File

@@ -3,21 +3,4 @@
#include "ast_def.h"
/**
* @brief 语义分析回调函数类型
*/
typedef void (*scc_sema_callback_t)(void *context,
scc_ast_node_type_t node_type, void *node);
/**
* @brief 语义分析回调集合
*/
typedef struct scc_sema_callbacks {
scc_sema_callback_t on_decl;
scc_sema_callback_t on_stmt;
scc_sema_callback_t on_expr;
scc_sema_callback_t on_type;
void *context;
} scc_sema_callbacks_t;
#endif /* __SCC_AST_H__ */