mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-12 06:46:19 +00:00
add List.clone
This commit is contained in:
parent
ebfcd71e8d
commit
f1ffc36efe
14 changed files with 147 additions and 4 deletions
|
@ -1518,6 +1518,15 @@ trait Backend<'a> {
|
|||
let elem_layout = list_element_layout!(self.interner(), *ret_layout);
|
||||
self.build_list_with_capacity(sym, args[0], arg_layouts[0], elem_layout, ret_layout)
|
||||
}
|
||||
LowLevel::ListClone => {
|
||||
debug_assert_eq!(
|
||||
1,
|
||||
args.len(),
|
||||
"ListClone: expected to have exactly one argument"
|
||||
);
|
||||
let elem_layout = list_element_layout!(self.interner(), *ret_layout);
|
||||
self.build_list_clone(*sym, args[0], elem_layout, *ret_layout)
|
||||
}
|
||||
LowLevel::ListReserve => {
|
||||
debug_assert_eq!(
|
||||
2,
|
||||
|
@ -2416,6 +2425,14 @@ trait Backend<'a> {
|
|||
fn build_indirect_inc(&mut self, layout: InLayout<'a>) -> Symbol;
|
||||
fn build_indirect_dec(&mut self, layout: InLayout<'a>) -> Symbol;
|
||||
|
||||
fn build_list_clone(
|
||||
&mut self,
|
||||
dst: Symbol,
|
||||
input_list: Symbol,
|
||||
elem_layout: InLayout<'a>,
|
||||
ret_layout: InLayout<'a>,
|
||||
);
|
||||
|
||||
/// build_list_with_capacity creates and returns a list with the given capacity.
|
||||
fn build_list_with_capacity(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue