1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix missing defer in fn main()

This commit is contained in:
krischerven 2020-04-11 19:38:14 -04:00 committed by GitHub
parent 0f19f9dd51
commit 1abdf2d68f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -885,11 +885,13 @@ fn (g mut Gen) gen_fn_decl(it ast.FnDecl) {
if g.is_test {
verror('test files cannot have function `main`')
}
g.writeln('\treturn 0;')
}
if g.defer_stmts.len > 0 {
g.write_defer_stmts()
}
if is_main {
g.writeln('\treturn 0;')
}
g.writeln('}')
g.defer_stmts = []
g.fn_decl = 0