mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Add List.append
implementation for generic64
This commit is contained in:
parent
9b525143cb
commit
0adb38beca
3 changed files with 96 additions and 5 deletions
|
@ -695,6 +695,14 @@ trait Backend<'a> {
|
|||
);
|
||||
self.build_list_reserve(sym, args, arg_layouts, ret_layout)
|
||||
}
|
||||
LowLevel::ListAppendUnsafe => {
|
||||
debug_assert_eq!(
|
||||
2,
|
||||
args.len(),
|
||||
"ListAppendUnsafe: expected to have exactly two arguments"
|
||||
);
|
||||
self.build_list_append_unsafe(sym, args, arg_layouts, ret_layout)
|
||||
}
|
||||
LowLevel::ListGetUnsafe => {
|
||||
debug_assert_eq!(
|
||||
2,
|
||||
|
@ -776,7 +784,7 @@ trait Backend<'a> {
|
|||
self.build_eq(sym, &args[0], &Symbol::DEV_TMP, &arg_layouts[0]);
|
||||
self.free_symbol(&Symbol::DEV_TMP)
|
||||
}
|
||||
Symbol::LIST_GET | Symbol::LIST_SET | Symbol::LIST_REPLACE => {
|
||||
Symbol::LIST_GET | Symbol::LIST_SET | Symbol::LIST_REPLACE | Symbol::LIST_APPEND => {
|
||||
// TODO: This is probably simple enough to be worth inlining.
|
||||
let layout_id = LayoutIds::default().get(func_sym, ret_layout);
|
||||
let fn_name = self.symbol_to_string(func_sym, layout_id);
|
||||
|
@ -952,6 +960,15 @@ trait Backend<'a> {
|
|||
ret_layout: &InLayout<'a>,
|
||||
);
|
||||
|
||||
/// build_list_append_unsafe returns a new list with a given element appended.
|
||||
fn build_list_append_unsafe(
|
||||
&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