1
0
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:
yuyi 2020-04-23 20:48:05 +08:00 committed by GitHub
parent f2e505d962
commit 2b4f72ef64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -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]
}

View File

@ -0,0 +1 @@
empty import

View File

@ -0,0 +1,7 @@
import (
// no module
)
fn main() {
println('empty import')
}