autofree: free_before_break() test
parent
321daede1d
commit
cb3367d734
|
@ -1044,7 +1044,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||
g.writeln('//af tmp')
|
||||
// g.autofree_call_pregen(node.exprs[0] as ast.CallExpr)
|
||||
}
|
||||
// g.autofree_scope_vars(node.pos.pos - 1)
|
||||
// g.autofree_scope_vars(node.pos.pos - 1, node.pos.line_nr, true)
|
||||
g.writeln('// ast.Return free_end')
|
||||
// g.write_autofree_stmts_when_needed(node)
|
||||
}
|
||||
|
|
|
@ -246,6 +246,16 @@ fn free_before_return_bool() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
fn free_before_break() {
|
||||
s := 'a' + 'b'
|
||||
for {
|
||||
q := [1, 2, 3]
|
||||
if true {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct User {
|
||||
name string
|
||||
age int
|
||||
|
@ -289,6 +299,7 @@ fn main() {
|
|||
free_inside_opt_block()
|
||||
// free_before_return()
|
||||
// free_before_return_bool()
|
||||
// free_before_break()
|
||||
// free_map()
|
||||
// loop_map()
|
||||
// free_array_except_returned_element()
|
||||
|
|
Loading…
Reference in New Issue