mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Implemented Str.concat
This commit is contained in:
parent
2f2763351d
commit
72558c61f1
3 changed files with 241 additions and 14 deletions
|
@ -893,7 +893,7 @@ pub fn list_concat<'a, 'ctx, 'env>(
|
|||
let if_first_list_is_empty = || {
|
||||
// second_list_len > 0
|
||||
// We do this check to avoid allocating memory. If the second input
|
||||
// list is empty, then we can just return the first list cloned
|
||||
// list is empty, then we can just return an empty list
|
||||
let second_list_length_comparison =
|
||||
list_is_not_empty(builder, ctx, second_list_len);
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ pub fn list_concat<'a, 'ctx, 'env>(
|
|||
|
||||
// This helper simulates a basic for loop, where
|
||||
// and index increments up from 0 to some end value
|
||||
fn incrementing_index_loop<'ctx, LoopFn>(
|
||||
pub fn incrementing_index_loop<'ctx, LoopFn>(
|
||||
builder: &Builder<'ctx>,
|
||||
parent: FunctionValue<'ctx>,
|
||||
ctx: &'ctx Context,
|
||||
|
@ -1161,7 +1161,7 @@ where
|
|||
index_alloca
|
||||
}
|
||||
|
||||
fn build_basic_phi2<'a, 'ctx, 'env, PassFn, FailFn>(
|
||||
pub fn build_basic_phi2<'a, 'ctx, 'env, PassFn, FailFn>(
|
||||
env: &Env<'a, 'ctx, 'env>,
|
||||
parent: FunctionValue<'ctx>,
|
||||
comparison: IntValue<'ctx>,
|
||||
|
@ -1228,7 +1228,7 @@ pub fn empty_list<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> BasicValueEnum<'
|
|||
BasicValueEnum::StructValue(struct_type.const_zero())
|
||||
}
|
||||
|
||||
fn list_is_not_empty<'ctx>(
|
||||
pub fn list_is_not_empty<'ctx>(
|
||||
builder: &Builder<'ctx>,
|
||||
ctx: &'ctx Context,
|
||||
list_len: IntValue<'ctx>,
|
||||
|
@ -1241,7 +1241,7 @@ fn list_is_not_empty<'ctx>(
|
|||
)
|
||||
}
|
||||
|
||||
fn load_list_ptr<'ctx>(
|
||||
pub fn load_list_ptr<'ctx>(
|
||||
builder: &Builder<'ctx>,
|
||||
wrapper_struct: StructValue<'ctx>,
|
||||
ptr_type: PointerType<'ctx>,
|
||||
|
@ -1254,7 +1254,7 @@ fn load_list_ptr<'ctx>(
|
|||
builder.build_int_to_ptr(ptr_as_int, ptr_type, "list_cast_ptr")
|
||||
}
|
||||
|
||||
fn clone_nonempty_list<'a, 'ctx, 'env>(
|
||||
pub fn clone_nonempty_list<'a, 'ctx, 'env>(
|
||||
env: &Env<'a, 'ctx, 'env>,
|
||||
list_len: IntValue<'ctx>,
|
||||
elems_ptr: PointerValue<'ctx>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue