builtin: same fix for array.insert

pull/6913/head
Alexander Medvednikov 2020-11-22 13:30:48 +01:00
parent f8827c3fe5
commit 65005fdae8
1 changed files with 6 additions and 0 deletions

View File

@ -5040,7 +5040,13 @@ fn (mut g Gen) gen_array_insert(node ast.CallExpr) {
g.write('.len)')
} else {
g.write(', &($elem_type_str[]){')
if left_info.elem_type == table.string_type {
g.write('string_clone(')
}
g.expr(node.args[1].expr)
if left_info.elem_type == table.string_type {
g.write(')')
}
g.write('})')
}
}