fix: 修复 harness 函数原型和 Object.assign ToObject

This commit is contained in:
爱特每羊队
2026-06-09 19:46:50 +08:00
parent e588fa4c8c
commit 16568c83fe
10 changed files with 131 additions and 16 deletions
+10
View File
@@ -129,6 +129,16 @@ impl CompileCtx {
self.next_reg = checkpoint;
}
pub(crate) fn reserve_reg(&mut self, reg: u8) {
let next = reg.wrapping_add(1);
if self.next_reg <= reg {
self.next_reg = next;
}
if self.max_regs < next {
self.max_regs = next;
}
}
pub(crate) fn add_constant(&mut self, c: Constant) -> u16 {
if let Some(idx) = self.constants.iter().position(|x| x == &c) {
return idx as u16;