fix autofree

pull/13954/head
crthpl 2022-04-05 14:54:46 -07:00
parent c4e319447d
commit 16e507151d
No known key found for this signature in database
GPG Key ID: B8BBDB4002CB6F74
1 changed files with 2 additions and 1 deletions

View File

@ -379,7 +379,8 @@ fn (mut g Gen) gen_assign_stmt(node_ ast.AssignStmt) {
g.write(', ')
}
mut cloned := false
if g.is_autofree && right_sym.kind in [.array, .string] {
if g.is_autofree && right_sym.kind in [.array, .string]
&& !unwrapped_val_type.has_flag(.shared_f) {
if g.gen_clone_assignment(val, unwrapped_val_type, false) {
cloned = true
}