mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Update alias analysis, implementation for List.mapWithIndex
This commit is contained in:
parent
71f2444397
commit
886e4e07f6
4 changed files with 12 additions and 6 deletions
|
@ -624,8 +624,9 @@ impl<'a> BorrowInfState<'a> {
|
|||
}
|
||||
}
|
||||
ListMapWithIndex { xs } => {
|
||||
// own the list if the function wants to own the element
|
||||
if !function_ps[1].borrow {
|
||||
// List.mapWithIndex : List before, (before, Nat -> after) -> List after
|
||||
// own the list if the function wants to own the element (before, index 0)
|
||||
if !function_ps[0].borrow {
|
||||
self.own_var(*xs);
|
||||
}
|
||||
}
|
||||
|
@ -943,7 +944,8 @@ pub fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[bool] {
|
|||
StrSplit => arena.alloc_slice_copy(&[borrowed, borrowed]),
|
||||
StrToNum => arena.alloc_slice_copy(&[borrowed]),
|
||||
ListSingle => arena.alloc_slice_copy(&[irrelevant]),
|
||||
ListRepeat => arena.alloc_slice_copy(&[irrelevant, borrowed]),
|
||||
// List.repeat : elem, Nat -> List.elem
|
||||
ListRepeat => arena.alloc_slice_copy(&[borrowed, irrelevant]),
|
||||
ListReverse => arena.alloc_slice_copy(&[owned]),
|
||||
ListPrepend => arena.alloc_slice_copy(&[owned, owned]),
|
||||
StrJoinWith => arena.alloc_slice_copy(&[borrowed, borrowed]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue