implement Str.concatUtf8

This commit is contained in:
shua 2024-06-07 02:02:46 +02:00
parent b3c28ebe66
commit 33e8a7a439
No known key found for this signature in database
GPG key ID: 73387DA37055770F
14 changed files with 102 additions and 0 deletions

View file

@ -608,6 +608,28 @@ pub(crate) fn run_low_level<'a, 'ctx>(
bitcode::STR_WITH_CAPACITY,
)
}
StrConcatUtf8 => {
// Str.concatUtf8: List U8, Str -> List U8
arguments!(list, string);
// XXX: I don't know why I need to call different functions based on the target pointer width, but the test_gen tests panic if I don't
match env.target.ptr_width() {
PtrWidth::Bytes4 => call_str_bitcode_fn(
env,
&[list, string],
&[],
BitcodeReturns::List,
bitcode::STR_CONCAT_UTF8,
),
PtrWidth::Bytes8 => call_list_bitcode_fn(
env,
&[list.into_struct_value()],
&[string],
BitcodeReturns::List,
bitcode::STR_CONCAT_UTF8,
),
}
}
ListLenU64 => {
// List.len : List * -> U64
arguments!(list);