fmt: allow parsing files without `fn main()` (#5681)
parent
8d035a446a
commit
d0e321c8a3
|
@ -0,0 +1 @@
|
|||
println('hello world')
|
|
@ -0,0 +1 @@
|
|||
println( "hello world" )
|
|
@ -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{}
|
||||
|
|
Loading…
Reference in New Issue