1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

autofree: handle SelectorExpr receivers

This commit is contained in:
Alexander Medvednikov 2020-11-21 23:19:01 +01:00
parent 22fdf76db5
commit ed7413ee51

View File

@ -1044,8 +1044,9 @@ pub fn (mut c Checker) call_expr(mut call_expr ast.CallExpr) table.Type {
}
call_expr.args[i].is_tmp_autofree = true
}
// TODO copy pasta from above
if call_expr.receiver_type == table.string_type && !(call_expr.left is ast.Ident ||
call_expr.left is ast.StringLiteral) {
call_expr.left is ast.StringLiteral || call_expr.left is ast.SelectorExpr) {
call_expr.free_receiver = true
}
}