将结构体、联合和枚举类型的字段表示从向量改为声明指针, 允许name和decl字段为null,更新相关初始化函数的断言检查, 使结构更加灵活并支持不完整类型定义。 BREAKING CHANGE: 修改了scc_ast_type结构体中record和enumeration 子类型的字段表示方法,从fields向量改为decl指针。
29 lines
703 B
C
29 lines
703 B
C
#ifndef __SCC_SEMA_H__
|
|
#define __SCC_SEMA_H__
|
|
|
|
#include <scc_ast.h>
|
|
|
|
/**
|
|
* @brief 语义分析回调函数类型
|
|
*/
|
|
typedef void (*scc_sema_callback_t)(void *context,
|
|
scc_ast_node_type_t node_type, void *node);
|
|
|
|
typedef scc_ast_type_t *(*scc_sema_got_type_t)(void *context, const char *name);
|
|
|
|
/**
|
|
* @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;
|
|
scc_sema_got_type_t got_type;
|
|
void *context;
|
|
} scc_sema_callbacks_t;
|
|
|
|
void scc_sema_init(scc_sema_callbacks_t *callbacks);
|
|
|
|
#endif /* __SCC_SEMA_H__ */
|