// Expect retcode = 0 // mangling:2ir(hir2ir)阶段把非根模块的函数名改编为模块限定名,避免跨模块同名 // 冲突(入口 main、按名查找)。根模块(mod 0)保持原名。'$' 不是 SPL 标识符字符, // 因此 "$$" 与任何未改编名都不冲突。 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() {}