mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Add List.reserve
implementation for generic64
This commit is contained in:
parent
5039a73d5c
commit
9b525143cb
3 changed files with 144 additions and 0 deletions
|
@ -687,6 +687,14 @@ trait Backend<'a> {
|
|||
);
|
||||
self.build_list_with_capacity(sym, args[0], arg_layouts[0], ret_layout)
|
||||
}
|
||||
LowLevel::ListReserve => {
|
||||
debug_assert_eq!(
|
||||
2,
|
||||
args.len(),
|
||||
"ListReserve: expected to have exactly two arguments"
|
||||
);
|
||||
self.build_list_reserve(sym, args, arg_layouts, ret_layout)
|
||||
}
|
||||
LowLevel::ListGetUnsafe => {
|
||||
debug_assert_eq!(
|
||||
2,
|
||||
|
@ -935,6 +943,15 @@ trait Backend<'a> {
|
|||
ret_layout: &InLayout<'a>,
|
||||
);
|
||||
|
||||
/// build_list_reserve enlarges a list to at least accommodate the given capacity.
|
||||
fn build_list_reserve(
|
||||
&mut self,
|
||||
dst: &Symbol,
|
||||
args: &'a [Symbol],
|
||||
arg_layouts: &[InLayout<'a>],
|
||||
ret_layout: &InLayout<'a>,
|
||||
);
|
||||
|
||||
/// build_list_get_unsafe loads the element from the list at the index.
|
||||
fn build_list_get_unsafe(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue