autofree: move new scope free behind -experimental for now

pull/5822/head
Alexander Medvednikov 2020-07-14 15:30:55 +02:00
parent 7231b467a6
commit c3ec5323f0
2 changed files with 5 additions and 5 deletions

View File

@ -622,7 +622,7 @@ fn (mut g Gen) stmts(stmts []ast.Stmt) {
g.write('') g.write('')
g.write(')') g.write(')')
} }
if g.pref.autofree && stmts.len > 0 { if g.pref.autofree && g.pref.experimental && stmts.len > 0 {
stmt := stmts[stmts.len - 1] stmt := stmts[stmts.len - 1]
if stmt !is ast.FnDecl { if stmt !is ast.FnDecl {
// g.writeln('// autofree scope') // g.writeln('// autofree scope')

View File

@ -140,10 +140,10 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) {
g.write_defer_stmts_when_needed() g.write_defer_stmts_when_needed()
} }
// ///////// // /////////
// if g.autofree { if g.autofree && !g.pref.experimental {
// TODO: remove this, when g.write_autofree_stmts_when_needed works properly // TODO: remove this, when g.write_autofree_stmts_when_needed works properly
// g.autofree_scope_vars(it.body_pos.pos) g.autofree_scope_vars(it.body_pos.pos)
// } }
g.writeln('}') g.writeln('}')
g.defer_stmts = [] g.defer_stmts = []
if g.pref.printfn_list.len > 0 && g.last_fn_c_name in g.pref.printfn_list { if g.pref.printfn_list.len > 0 && g.last_fn_c_name in g.pref.printfn_list {