This commit is contained in:
J.Teeuwissen 2023-04-22 14:20:48 +02:00
parent d4379ff895
commit a0f8b50efe
No known key found for this signature in database
GPG key ID: DB5F7A1ED8D478AD

View file

@ -380,6 +380,34 @@ fn specialize_drops_stmt<'a, 'i>(
}
}
}
Layout::Boxed(_layout) => {
let removed = match incremented_children.iter().next() {
Some(s) => incremented_children.remove(&s.clone()),
None => false,
};
let new_continuation = specialize_drops_stmt(
arena,
layout_interner,
ident_ids,
environment,
continuation,
);
if removed {
// No need to decrement the containing value since we already decremented the child.
arena.alloc(Stmt::Refcounting(
ModifyRc::DecRef(*symbol),
new_continuation,
))
} else {
// No known children, keep decrementing the symbol.
arena.alloc(Stmt::Refcounting(
ModifyRc::Dec(*symbol),
new_continuation,
))
}
}
// TODO: Implement this with uniqueness checks.
_ => {
let new_continuation = specialize_drops_stmt(