feat: lookup at downgrade time

works, but leaks memory
This commit is contained in:
2025-06-01 09:20:04 +08:00
parent 7d6168fdae
commit 20b2b6f1ef
20 changed files with 762 additions and 651 deletions

View File

@@ -73,13 +73,17 @@ impl<'gc> PartialPrimOp<'gc> {
mc: &Mutation<'gc>,
) -> Result<Value<'gc>> {
let func = self.func;
let self_mut = self.make_mut(mc);
self_mut.args.push(arg);
self_mut.arity -= 1;
if self_mut.arity > 0 {
Value::PartialPrimOp(self.clone()).ok()
} else {
func(std::mem::take(&mut self_mut.args), vm, mc)
}
let Some(ret) = self.make_mut(|self_mut| {
self_mut.args.push(arg);
self_mut.arity -= 1;
if self_mut.arity == 0 {
Some(func(std::mem::take(&mut self_mut.args), vm, mc))
} else {
None
}
}, mc) else {
return Value::PartialPrimOp(self.clone()).ok();
};
ret
}
}