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:
parent
8d035a446a
commit
d0e321c8a3
1
vlib/v/fmt/tests/no_main_expected.vv
Normal file
1
vlib/v/fmt/tests/no_main_expected.vv
Normal file
@ -0,0 +1 @@
|
||||
println('hello world')
|
1
vlib/v/fmt/tests/no_main_input.vv
Normal file
1
vlib/v/fmt/tests/no_main_input.vv
Normal file
@ -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
Block a user