mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix empty import error
This commit is contained in:
parent
f2e505d962
commit
2b4f72ef64
@ -302,6 +302,9 @@ pub fn (mut p Parser) top_stmt() ast.Stmt {
|
||||
}
|
||||
.key_import {
|
||||
node := p.import_stmt()
|
||||
if node.len == 0 {
|
||||
return p.top_stmt()
|
||||
}
|
||||
p.ast_imports << node
|
||||
return node[0]
|
||||
}
|
||||
|
1
vlib/v/tests/inout/empty_import.out
Normal file
1
vlib/v/tests/inout/empty_import.out
Normal file
@ -0,0 +1 @@
|
||||
empty import
|
7
vlib/v/tests/inout/empty_import.vv
Normal file
7
vlib/v/tests/inout/empty_import.vv
Normal file
@ -0,0 +1,7 @@
|
||||
import (
|
||||
// no module
|
||||
)
|
||||
|
||||
fn main() {
|
||||
println('empty import')
|
||||
}
|
Loading…
Reference in New Issue
Block a user