autofree: free reference types with -experimental for now

pull/11948/head
Alexander Medvednikov 2021-09-23 04:35:09 +03:00
parent 52b53f17b2
commit 7b60367512
2 changed files with 2 additions and 2 deletions

View File

@ -3246,7 +3246,7 @@ fn (mut g Gen) autofree_variable(v ast.Var) {
}
if sym.has_method('free') {
g.autofree_var_call(c_name(sym.name) + '_free', v)
} else if v.typ.is_ptr() && sym.name.after('.')[0].is_capital() {
} else if g.pref.experimental && v.typ.is_ptr() && sym.name.after('.')[0].is_capital() {
// Free user reference types
g.autofree_var_call('free', v)
}

View File

@ -74,7 +74,7 @@ fn test_all() {
//
exe_filename := '$wrkdir/x'
full_path_to_source_file := os.join_path(vroot, test)
compile_cmd := '$vexe -o $exe_filename -cg -cflags "-w" -autofree "$full_path_to_source_file"'
compile_cmd := '$vexe -o $exe_filename -cg -cflags "-w" -experimental -autofree "$full_path_to_source_file"'
vprintln('compile cmd: ${bold(compile_cmd)}')
res := os.execute(compile_cmd)
if res.exit_code != 0 {