fix: 全量单测修复(flatten 健壮性 + 测试链路补 flatten + 断言对齐规范)

This commit is contained in:
爱特每羊队
2026-08-08 16:03:24 +08:00
parent 6e5bbe718b
commit 3a8bf56a68
6 changed files with 25 additions and 17 deletions
+1
View File
@@ -17,3 +17,4 @@ oxide_parser = { path = "../oxide_parser" }
oxide_emit = { path = "../oxide_emit" }
oxide_vm = { path = "../oxide_vm" }
oxide_dce = { path = "../oxide_dce" }
oxide_compiler = { path = "../oxide_compiler" }
@@ -22,6 +22,10 @@ fn run_source(src: &str, regalloc: bool) -> Result<JsValue, String> {
oxide_regalloc::alloc(&mut ir, &live2)?;
}
let module = oxide_ir::lower::lower(&ir).expect("lower failed");
// 测试走底层链路(不经 Compiler::compile),需手动扁平化子模块,
// 否则 CREATE_CLOSURE 的相对索引在运行期越界。
let mut module = module;
oxide_compiler::flatten::flatten_submodules(&mut module);
let mut vm = Vm::new();
vm.run(&module)
}