autofree: string.clone() fix
parent
65005fdae8
commit
311b5e8188
|
@ -2911,12 +2911,13 @@ fn (mut g Gen) infix_expr(node ast.InfixExpr) {
|
||||||
if elem_sym.kind == .interface_ && node.right_type != info.elem_type {
|
if elem_sym.kind == .interface_ && node.right_type != info.elem_type {
|
||||||
g.interface_call(node.right_type, info.elem_type)
|
g.interface_call(node.right_type, info.elem_type)
|
||||||
}
|
}
|
||||||
// if g.pref.autofree && info.elem_type == table.string_type {
|
// if g.pref.autofree
|
||||||
if info.elem_type == table.string_type {
|
needs_clone := info.elem_type == table.string_type && !g.is_builtin_mod
|
||||||
|
if needs_clone {
|
||||||
g.write('string_clone(')
|
g.write('string_clone(')
|
||||||
}
|
}
|
||||||
g.expr_with_cast(node.right, node.right_type, info.elem_type)
|
g.expr_with_cast(node.right, node.right_type, info.elem_type)
|
||||||
if info.elem_type == table.string_type {
|
if needs_clone {
|
||||||
g.write(')')
|
g.write(')')
|
||||||
}
|
}
|
||||||
if is_interface {
|
if is_interface {
|
||||||
|
|
Loading…
Reference in New Issue