closure_env_layout

This commit is contained in:
Folkert 2021-06-16 22:15:55 +02:00
parent b54033a2f5
commit cc98237a0a
6 changed files with 57 additions and 45 deletions

View file

@ -143,6 +143,14 @@ impl<'a> LambdaSet<'a> {
*self.representation
}
pub fn is_represented(&self) -> Option<Layout<'a>> {
if let Layout::Struct(&[]) = self.representation {
None
} else {
Some(*self.representation)
}
}
pub fn layout_for_member(&self, function_symbol: Symbol) -> ClosureRepresentation<'a> {
debug_assert!(
self.set.iter().any(|(s, _)| *s == function_symbol),