mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
make List.map borrow based on passed function
This commit is contained in:
parent
3a4a78fdbb
commit
3ca6ffade9
8 changed files with 106 additions and 35 deletions
|
@ -409,14 +409,36 @@ impl<'a> BorrowInfState<'a> {
|
|||
|
||||
LowLevel {
|
||||
op,
|
||||
opt_closure_layout: _,
|
||||
opt_closure_layout,
|
||||
} => {
|
||||
// very unsure what demand RunLowLevel should place upon its arguments
|
||||
self.own_var(z);
|
||||
use roc_module::low_level::LowLevel::*;
|
||||
match op {
|
||||
ListMap => {
|
||||
match self
|
||||
.param_map
|
||||
.get_symbol(arguments[1], opt_closure_layout.unwrap())
|
||||
{
|
||||
Some(ps) => {
|
||||
if !ps[0].borrow {
|
||||
self.own_var(arguments[0]);
|
||||
}
|
||||
|
||||
let ps = lowlevel_borrow_signature(self.arena, *op);
|
||||
if ps.len() > 1 && !ps[1].borrow {
|
||||
self.own_var(arguments[2]);
|
||||
}
|
||||
}
|
||||
None => unreachable!(),
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// very unsure what demand RunLowLevel should place upon its arguments
|
||||
self.own_var(z);
|
||||
|
||||
self.own_args_using_bools(arguments, ps);
|
||||
let ps = lowlevel_borrow_signature(self.arena, *op);
|
||||
|
||||
self.own_args_using_bools(arguments, ps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Foreign { .. } => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue