fixed specialisation box

This commit is contained in:
J.Teeuwissen 2023-05-28 21:18:28 +02:00
parent ffc19ec2a2
commit 8f022d4310
No known key found for this signature in database
GPG key ID: DB5F7A1ED8D478AD
2 changed files with 6 additions and 9 deletions

View file

@ -958,23 +958,20 @@ fn specialize_boxed<'a, 'i>(
*symbol,
// If the symbol is unique:
// - free the box
|_, _, _| {
|_, _, continuation| {
arena.alloc(Stmt::Refcounting(
// TODO can be replaced by free if ever added to the IR.
ModifyRc::DecRef(*symbol),
new_continuation,
continuation,
))
},
// If the symbol is not unique:
// - increment the child
// - decref the box
|_, _, _| {
|_, _, continuation| {
arena.alloc(Stmt::Refcounting(
ModifyRc::Inc(s, 1),
arena.alloc(Stmt::Refcounting(
ModifyRc::DecRef(*symbol),
new_continuation,
)),
arena.alloc(Stmt::Refcounting(ModifyRc::DecRef(*symbol), continuation)),
))
},
new_continuation,