refactor(ast): 移除内置类型头文件并优化类型初始化
移除了独立的ast_builtin.h头文件,将内置类型定义整合到现有结构中, 同时修复了类型初始化函数命名不一致的问题。 BREAKING CHANGE: 原有的ast_builtin.h头文件已被移除, 相关内置类型声明已重构为新的接口形式。 fix(parser): 修复表达式解析中的位置信息处理 确保条件表达式和逗号表达式的解析正确获取并传递位置信息, 避免在语法树构建过程中丢失源码位置。 refactor(ir): 修复IR转储中的类型转换问题 添加必要的类型转换以防止整数溢出,并优化代码格式以提高可读性。 feat(parser): 添加表达式解析测试套件 引入全面的表达式解析测试框架,覆盖从基本表达式到复杂嵌套表达式 的各种场景,确保解析器功能的正确性和稳定性。
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
#ifndef __SCC_AST_BUILTIN_H__
|
||||
#define __SCC_AST_BUILTIN_H__
|
||||
|
||||
#include "ast_def.h"
|
||||
|
||||
extern scc_ast_type_t scc_ast_builtin_type_va_list;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_void;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_bool;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_char;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_short;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_long;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_long_long;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_int;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_float;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_double;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_long_double;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_complex_float;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_complex_double;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_complex_long_double;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_unsigned_char;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_unsigned_short;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_unsigned_int;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_unsigned_long;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_unsigned_long_long;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_signed_char;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_signed_short;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_signed_int;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_signed_long;
|
||||
extern scc_ast_type_t scc_ast_builtin_type_signed_long_long;
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef __SCC_AST_H__
|
||||
#define __SCC_AST_H__
|
||||
|
||||
#include "ast_builtin.h"
|
||||
#include "ast_def.h"
|
||||
#include "ast_dump.h"
|
||||
|
||||
@@ -508,9 +507,9 @@ static inline void scc_ast_expr_lvalue_init(scc_ast_expr_t *expr,
|
||||
}
|
||||
|
||||
// have defined builtin type
|
||||
static inline void _scc_ast_type_builtin_init(scc_ast_type_t *type,
|
||||
scc_ast_builtin_type_t builtin,
|
||||
scc_pos_t loc) {
|
||||
static inline void scc_ast_type_builtin_init(scc_ast_type_t *type,
|
||||
scc_ast_builtin_type_t builtin,
|
||||
scc_pos_t loc) {
|
||||
Assert(type != null);
|
||||
type->base.loc = loc;
|
||||
type->base.type = SCC_AST_TYPE_BUILTIN;
|
||||
|
||||
Reference in New Issue
Block a user