fix too many arguments

This commit is contained in:
Folkert 2021-06-19 21:26:06 +02:00
parent c26d20e4e5
commit e912edcfdd

View file

@ -910,13 +910,14 @@ test "endsWith: hello world ends with world" {
}
// Str.concat
pub fn strConcatC(result_in_place: InPlace, arg1: RocStr, arg2: RocStr) callconv(.C) RocStr {
return @call(.{ .modifier = always_inline }, strConcat, .{ result_in_place, arg1, arg2 });
pub fn strConcatC(arg1: RocStr, arg2: RocStr) callconv(.C) RocStr {
return @call(.{ .modifier = always_inline }, strConcat, .{ arg1, arg2 });
}
fn strConcat(result_in_place: InPlace, arg1: RocStr, arg2: RocStr) RocStr {
fn strConcat(arg1: RocStr, arg2: RocStr) RocStr {
if (arg1.isEmpty()) {
// the second argument is borrowed, so we must increment its refcount before returning
const result_in_place = InPlace.Clone;
return RocStr.clone(result_in_place, arg2);
} else if (arg2.isEmpty()) {
// the first argument is owned, so we can return it without cloning