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

fmt: allow parsing files without fn main() (#5681)

This commit is contained in:
spaceface777 2020-07-05 20:53:01 +02:00 committed by GitHub
parent 8d035a446a
commit d0e321c8a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 0 deletions

View File

@ -0,0 +1 @@
println('hello world')

View File

@ -0,0 +1 @@
println( "hello world" )

View File

@ -452,6 +452,8 @@ pub fn (mut p Parser) top_stmt() ast.Stmt {
file: p.file_name
return_type: table.void_type
}
} else if p.pref.is_fmt {
return p.stmt(false)
} else {
p.error('bad top level statement ' + p.tok.str())
return ast.Stmt{}