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
+11
View File
@@ -29,6 +29,17 @@ static inline const char* type_name(TypeKind kind) {
}
}
// === 源码位置(替代分散的 line/col 参数)===
typedef struct {
int line;
int col;
} SourceLoc;
// 手动创建 SourceLoc
static inline SourceLoc loc_at(int line, int col) {
return (SourceLoc){ .line = line, .col = col };
}
// === 向前声明 ===
typedef struct Token Token;
typedef struct AstNode AstNode;