cgen: fix missing defer in fn main()
parent
0f19f9dd51
commit
1abdf2d68f
|
@ -885,11 +885,13 @@ fn (g mut Gen) gen_fn_decl(it ast.FnDecl) {
|
||||||
if g.is_test {
|
if g.is_test {
|
||||||
verror('test files cannot have function `main`')
|
verror('test files cannot have function `main`')
|
||||||
}
|
}
|
||||||
g.writeln('\treturn 0;')
|
|
||||||
}
|
}
|
||||||
if g.defer_stmts.len > 0 {
|
if g.defer_stmts.len > 0 {
|
||||||
g.write_defer_stmts()
|
g.write_defer_stmts()
|
||||||
}
|
}
|
||||||
|
if is_main {
|
||||||
|
g.writeln('\treturn 0;')
|
||||||
|
}
|
||||||
g.writeln('}')
|
g.writeln('}')
|
||||||
g.defer_stmts = []
|
g.defer_stmts = []
|
||||||
g.fn_decl = 0
|
g.fn_decl = 0
|
||||||
|
|
Loading…
Reference in New Issue