fix autofree of heap variables

pull/13823/head
Daniel Oberhoff 2022-03-25 10:56:28 +01:00
parent d6c40865f9
commit 1877ca6d95
1 changed files with 5 additions and 1 deletions

View File

@ -2685,9 +2685,13 @@ fn (mut g Gen) autofree_var_call(free_fn_name string, v ast.Var) {
if v.typ == ast.error_type && !v.is_autofree_tmp { if v.typ == ast.error_type && !v.is_autofree_tmp {
return return
} }
if v.is_auto_heap {
g.writeln('\t${free_fn_name}(${c_name(v.name)}); // autofreed heap var $g.cur_mod.name $g.is_builtin_mod')
} else {
g.writeln('\t${free_fn_name}(&${c_name(v.name)}); // autofreed var $g.cur_mod.name $g.is_builtin_mod') g.writeln('\t${free_fn_name}(&${c_name(v.name)}); // autofreed var $g.cur_mod.name $g.is_builtin_mod')
} }
} }
}
fn (mut g Gen) map_fn_ptrs(key_typ ast.TypeSymbol) (string, string, string, string) { fn (mut g Gen) map_fn_ptrs(key_typ ast.TypeSymbol) (string, string, string, string) {
mut hash_fn := '' mut hash_fn := ''