cgen: fix autofree_variable() (fix #14576) (#14602)

master
yuyi 2022-06-03 22:41:30 +08:00 committed by GitHub
parent dcbd8d6405
commit daa94de93f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -2679,6 +2679,10 @@ fn (mut g Gen) autofree_scope_vars2(scope &ast.Scope, start_pos int, end_pos int
} }
fn (mut g Gen) autofree_variable(v ast.Var) { fn (mut g Gen) autofree_variable(v ast.Var) {
// filter out invalid variables
if v.typ == 0 {
return
}
sym := g.table.sym(v.typ) sym := g.table.sym(v.typ)
// if v.name.contains('output2') { // if v.name.contains('output2') {
if g.is_autofree { if g.is_autofree {