stage3 ai编写并提供测试用例并重构nob
This commit is contained in:
1 parent
2c531f23de
commit
b4831c8d1c
150 files changed
+15838
-231
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// Expect retcode = 0
|
||||
|
||||
// mangling:2ir(hir2ir)阶段把非根模块的函数名改编为模块限定名,避免跨模块同名
|
||||
// 冲突(入口 main、按名查找)。根模块(mod 0)保持原名。'$' 不是 SPL 标识符字符,
|
||||
// 因此 "$<mod>$<name>" 与任何未改编名都不冲突。
|
||||
|
||||
type .{ .ByteBuffer } = @import("../stage2/utils/byte_buffer.spl");
|
||||
type .{ .append_usize } = @import("../stage2/utils/fmt.spl");
|
||||
|
||||
fn needs_mangling(mod: usize): bool {
|
||||
ret mod != 0;
|
||||
}
|
||||
|
||||
fn mangle(mod: usize, name: []u8, out: *ByteBuffer) {
|
||||
ByteBuffer.append_byte(out, '$');
|
||||
append_usize(out, mod, 10, false);
|
||||
ByteBuffer.append_byte(out, '$');
|
||||
ByteBuffer.append(out, name);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Reference in new issue
Block a user