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:
@@ -0,0 +1,19 @@
|
||||
struct Point {
|
||||
x: i64,
|
||||
y: i64,
|
||||
}
|
||||
|
||||
fn make_point(x: i64, y: i64) -> Point {
|
||||
return Point { x: x, y: y };
|
||||
}
|
||||
|
||||
fn print_point(p: Point) -> void {
|
||||
print_i64(p.x);
|
||||
print_i64(p.y);
|
||||
}
|
||||
|
||||
fn main() -> i64 {
|
||||
let p: Point = make_point(3, 4);
|
||||
print_point(p);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user