feat: struct参数/返回值 + SourceLoc + 测试补全

- struct 可作函数参数和返回值 (fn make_point -> Point)
- SourceLoc 抽象: 所有 ast_make_* 参数 + AstNode 迁移完毕
- sema: +4 struct 类型检查测试 (字段类型/未定义/数量/嵌套)
- codegen: +2 struct IR 生成测试 (decl + field_access)
- 新增集成测试 14_struct_fn.l

测试: 104 单元 + 14 集成 = 全部通过
This commit is contained in:
2026-06-05 13:29:31 +08:00
parent 4046ab1875
commit da9a7065dd
12 changed files with 481 additions and 168 deletions
+5
View File
@@ -41,6 +41,11 @@ struct Token {
const char* tok_name(TokenKind kind);
bool tok_is_type(TokenKind kind);
// 从 Token 创建 SourceLoc
static inline SourceLoc tok_loc(const Token* tok) {
return (SourceLoc){ .line = tok->line, .col = tok->col };
}
// 从 Token 提取值
int64_t tok_int_value(const Token* tok);
double tok_float_value(const Token* tok);