mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
List.appendUnsafe and List.reserve
This commit is contained in:
parent
dda79a255e
commit
56c9787e8f
13 changed files with 165 additions and 81 deletions
|
@ -8,10 +8,10 @@ use crate::llvm::build_dict::{
|
|||
};
|
||||
use crate::llvm::build_hash::generic_hash;
|
||||
use crate::llvm::build_list::{
|
||||
self, allocate_list, empty_polymorphic_list, list_append, list_concat, list_drop_at,
|
||||
self, allocate_list, empty_polymorphic_list, list_append_unsafe, list_concat, list_drop_at,
|
||||
list_get_unsafe, list_len, list_map, list_map2, list_map3, list_map4, list_prepend,
|
||||
list_replace_unsafe, list_sort_with, list_sublist, list_swap, list_symbol_to_c_abi,
|
||||
list_to_c_abi, list_with_capacity,
|
||||
list_replace_unsafe, list_reserve, list_sort_with, list_sublist, list_swap,
|
||||
list_symbol_to_c_abi, list_to_c_abi, list_with_capacity,
|
||||
};
|
||||
use crate::llvm::build_str::{str_from_float, str_from_int, str_from_utf8, str_from_utf8_range};
|
||||
use crate::llvm::compare::{generic_eq, generic_neq};
|
||||
|
@ -5531,14 +5531,24 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
|
||||
list_concat(env, first_list, second_list, element_layout)
|
||||
}
|
||||
ListAppend => {
|
||||
// List.append : List elem, elem -> List elem
|
||||
ListAppendUnsafe => {
|
||||
// List.appendUnsafe : List elem, elem -> List elem
|
||||
debug_assert_eq!(args.len(), 2);
|
||||
|
||||
let original_wrapper = load_symbol(scope, &args[0]).into_struct_value();
|
||||
let (elem, elem_layout) = load_symbol_and_layout(scope, &args[1]);
|
||||
|
||||
list_append(env, original_wrapper, elem, elem_layout, update_mode)
|
||||
list_append_unsafe(env, original_wrapper, elem, elem_layout)
|
||||
}
|
||||
ListReserve => {
|
||||
// List.reserve : List elem, Nat -> List elem
|
||||
debug_assert_eq!(args.len(), 2);
|
||||
|
||||
let (list, list_layout) = load_symbol_and_layout(scope, &args[0]);
|
||||
let element_layout = list_element_layout!(list_layout);
|
||||
let spare = load_symbol(scope, &args[1]);
|
||||
|
||||
list_reserve(env, list, spare, element_layout, update_mode)
|
||||
}
|
||||
ListSwap => {
|
||||
// List.swap : List elem, Nat, Nat -> List elem
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue