start resetref

This commit is contained in:
J.Teeuwissen 2023-03-29 11:57:13 +02:00
parent 61efec6fe2
commit d4ed6f7778
No known key found for this signature in database
GPG key ID: DB5F7A1ED8D478AD
13 changed files with 214 additions and 18 deletions

View file

@ -1935,6 +1935,13 @@ pub enum Expr<'a> {
update_mode: UpdateModeId,
},
// Just like Reset, but does not recursively decrement the children.
// Used in reuse analysis to replace a decref with a resetRef to avoid decrementing when the dec ref didn't.
ResetRef {
symbol: Symbol,
update_mode: UpdateModeId,
},
RuntimeErrorFunction(&'a str),
}
@ -2057,7 +2064,13 @@ impl<'a> Expr<'a> {
"Reset {{ symbol: {:?}, id: {} }}",
symbol, update_mode.id
)),
ResetRef {
symbol,
update_mode,
} => alloc.text(format!(
"ResetRef {{ symbol: {:?}, id: {} }}",
symbol, update_mode.id
)),
Struct(args) => {
let it = args.iter().map(|s| symbol_to_doc(alloc, *s, pretty));
@ -7187,7 +7200,9 @@ fn substitute_in_expr<'a>(
}
}
Reuse { .. } | Reset { .. } => unreachable!("reset/reuse have not been introduced yet"),
Reuse { .. } | Reset { .. } | ResetRef { .. } => {
unreachable!("reset/resetref/reuse have not been introduced yet")
}
Struct(args) => {
let mut did_change = false;