parser: fix error when accessing module without name after dot (#7530)
parent
c6b0ce2a07
commit
1605c3b5f8
|
@ -1147,7 +1147,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
|
|||
// mark the imported module as used
|
||||
p.register_used_import(p.tok.lit)
|
||||
if p.peek_tok.kind == .dot &&
|
||||
p.peek_tok2.kind != .eof && p.peek_tok2.lit[0].is_capital() {
|
||||
p.peek_tok2.kind != .eof && p.peek_tok2.lit.len > 0 && p.peek_tok2.lit[0].is_capital() {
|
||||
is_mod_cast = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
vlib/v/parser/tests/uncomplete_module_call_err.vv:7:1: error: unexpected token ``
|
||||
5 | fn main() {
|
||||
6 | os.
|
||||
7 | }
|
||||
| ^
|
|
@ -0,0 +1,7 @@
|
|||
module main
|
||||
|
||||
import os
|
||||
|
||||
fn main() {
|
||||
os.
|
||||
}
|
Loading…
Reference in New Issue