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

cgen: fix -autofree

This commit is contained in:
Alexander Medvednikov 2020-05-07 17:51:30 +02:00
parent 3c6e090ae3
commit ef387779bf

View File

@ -1054,7 +1054,7 @@ fn (mut g Gen) autofree_scope_vars(pos int) string {
fn (g &Gen) autofree_variable(v ast.Var) string { fn (g &Gen) autofree_variable(v ast.Var) string {
sym := g.table.get_type_symbol(v.typ) sym := g.table.get_type_symbol(v.typ)
// if v.name.contains('output2') { // if v.name.contains('output2') {
eprintln(' > var name: ${v.name:-20s} | is_arg: ${v.is_arg.str():6} | var type: ${int(v.typ):8} | type_name: ${sym.name:-33s}') // eprintln(' > var name: ${v.name:-20s} | is_arg: ${v.is_arg.str():6} | var type: ${int(v.typ):8} | type_name: ${sym.name:-33s}')
// } // }
if sym.kind == .array { if sym.kind == .array {
return g.autofree_var_call('array_free', v) return g.autofree_var_call('array_free', v)
@ -1069,7 +1069,7 @@ fn (g &Gen) autofree_variable(v ast.Var) string {
else { else {
// NOTE/TODO: assign_stmt multi returns variables have no expr // NOTE/TODO: assign_stmt multi returns variables have no expr
// since the type comes from the called fns return type // since the type comes from the called fns return type
// return '// other ' + t + '\n' return '// other ' + t + '\n'
} }
} }
return g.autofree_var_call('string_free', v) return g.autofree_var_call('string_free', v)