mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
remove T from join
This commit is contained in:
parent
517bde4f4a
commit
5a62359a5f
2 changed files with 6 additions and 17 deletions
|
@ -870,19 +870,15 @@ pub const RocListStr = extern struct {
|
|||
|
||||
// Str.joinWith
|
||||
// When we actually use this in Roc, libc will be linked so we have access to std.heap.c_allocator
|
||||
pub fn strJoinWithC(ptr_size: u32, list: RocListStr, separator: RocStr) callconv(.C) RocStr {
|
||||
return @call(.{ .modifier = always_inline }, strJoinWith, .{ std.heap.c_allocator, ptr_size, list, separator });
|
||||
pub fn strJoinWithC(list: RocListStr, separator: RocStr) callconv(.C) RocStr {
|
||||
return @call(.{ .modifier = always_inline }, strJoinWith, .{ std.heap.c_allocator, list, separator });
|
||||
}
|
||||
|
||||
fn strJoinWith(allocator: *Allocator, ptr_size: u32, list: RocListStr, separator: RocStr) RocStr {
|
||||
return switch (ptr_size) {
|
||||
4 => strJoinWithHelp(allocator, i32, list, separator),
|
||||
8 => strJoinWithHelp(allocator, i64, list, separator),
|
||||
else => unreachable,
|
||||
};
|
||||
fn strJoinWith(allocator: *Allocator, list: RocListStr, separator: RocStr) RocStr {
|
||||
return strJoinWithHelp(allocator, list, separator);
|
||||
}
|
||||
|
||||
fn strJoinWithHelp(allocator: *Allocator, comptime T: type, list: RocListStr, separator: RocStr) RocStr {
|
||||
fn strJoinWithHelp(allocator: *Allocator, list: RocListStr, separator: RocStr) RocStr {
|
||||
const len = list.list_length;
|
||||
|
||||
if (len == 0) {
|
||||
|
|
|
@ -178,14 +178,7 @@ pub fn str_join_with<'a, 'ctx, 'env>(
|
|||
|
||||
let zig_result = call_bitcode_fn(
|
||||
env,
|
||||
&[
|
||||
env.context
|
||||
.i32_type()
|
||||
.const_int(env.ptr_bytes as u64, false)
|
||||
.into(),
|
||||
list_i128.into(),
|
||||
str_i128.into(),
|
||||
],
|
||||
&[list_i128.into(), str_i128.into()],
|
||||
&bitcode::STR_JOIN_WITH,
|
||||
)
|
||||
.into_struct_value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue