mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.parser: fix error on empty name expr (#10860)
This commit is contained in:
parent
425ca5e3c3
commit
9127e202d5
@ -2093,7 +2093,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
|
||||
// if name in ast.builtin_type_names {
|
||||
if (!known_var && (name in p.table.type_idxs || name_w_mod in p.table.type_idxs)
|
||||
&& name !in ['C.stat', 'C.sigaction']) || is_mod_cast || is_generic_cast
|
||||
|| (language == .v && name[0].is_capital()) {
|
||||
|| (language == .v && name.len > 0 && name[0].is_capital()) {
|
||||
// MainLetter(x) is *always* a cast, as long as it is not `C.`
|
||||
// TODO handle C.stat()
|
||||
start_pos := p.tok.position()
|
||||
|
5
vlib/v/parser/tests/empty_name_expr_err.out
Normal file
5
vlib/v/parser/tests/empty_name_expr_err.out
Normal file
@ -0,0 +1,5 @@
|
||||
vlib/v/parser/tests/empty_name_expr_err.vv:2:9: error: unexpected name `n`
|
||||
1 | fn main() {
|
||||
2 | return n ?(
|
||||
| ^
|
||||
3 | }
|
3
vlib/v/parser/tests/empty_name_expr_err.vv
Normal file
3
vlib/v/parser/tests/empty_name_expr_err.vv
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
return n ?(
|
||||
}
|
Loading…
Reference in New Issue
Block a user