mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
don't pass closure argument if not expected
This commit is contained in:
parent
c68689a52b
commit
7416cc4e81
3 changed files with 52 additions and 3 deletions
|
@ -455,6 +455,17 @@ impl<'a> LambdaSet<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn member_does_not_need_closure_argument(&self, function_symbol: Symbol) -> bool {
|
||||
match self.layout_for_member(function_symbol) {
|
||||
ClosureRepresentation::Union {
|
||||
alphabetic_order_fields,
|
||||
..
|
||||
} => alphabetic_order_fields.is_empty(),
|
||||
ClosureRepresentation::AlphabeticOrderStruct(fields) => fields.is_empty(),
|
||||
ClosureRepresentation::Other(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn layout_for_member(&self, function_symbol: Symbol) -> ClosureRepresentation<'a> {
|
||||
debug_assert!(
|
||||
self.set.iter().any(|(s, _)| *s == function_symbol),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue