mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
parent
5dc98cca3e
commit
bb36be5e94
1 changed files with 26 additions and 0 deletions
|
@ -403,6 +403,19 @@ impl<'v> RefcountEnvironment<'v> {
|
|||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Get all consumpomptiun values from joinpoint_closures
|
||||
fn is_joinpoint_consumptions_all_empty_or_borrowed(&self) -> bool {
|
||||
self.jointpoint_closures.values().all(|consumption| {
|
||||
consumption.is_empty()
|
||||
|| consumption.iter().all(|symbol| {
|
||||
matches!(
|
||||
self.symbols_ownership.get(symbol),
|
||||
Some(Ownership::Borrowed)
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -779,7 +792,20 @@ fn insert_refcount_operations_stmt<'v, 'a>(
|
|||
As the consumption should only ever increase.
|
||||
Otherwise we will be looping forever."
|
||||
);
|
||||
|
||||
current_body_env
|
||||
.add_joinpoint_consumption(*joinpoint_id, joinpoint_consumption.clone());
|
||||
|
||||
let all_empty_or_borrowed =
|
||||
current_body_env.is_joinpoint_consumptions_all_empty_or_borrowed();
|
||||
|
||||
current_body_env.remove_joinpoint_consumption(*joinpoint_id);
|
||||
|
||||
joinpoint_consumption = current_joinpoint_consumption;
|
||||
|
||||
if all_empty_or_borrowed {
|
||||
break (new_body, current_body_env);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue