mirror of
https://github.com/vlang/v.git
synced 2025-09-10 16:00:31 -04:00
parser: improve the error for keyword lock
, used as a variable name (#21937)
This commit is contained in:
parent
52fe7c09b8
commit
0ef2501216
@ -72,7 +72,7 @@ fn (mut p Parser) lock_expr() ast.LockExpr {
|
|||||||
for {
|
for {
|
||||||
is_rlock := p.tok.kind == .key_rlock
|
is_rlock := p.tok.kind == .key_rlock
|
||||||
if !is_rlock && p.tok.kind != .key_lock {
|
if !is_rlock && p.tok.kind != .key_lock {
|
||||||
p.unexpected(expecting: '`lock` or `rlock`')
|
p.unexpected(expecting: 'one or more shared variable names')
|
||||||
}
|
}
|
||||||
p.next()
|
p.next()
|
||||||
if p.tok.kind == .lcbr {
|
if p.tok.kind == .lcbr {
|
||||||
|
3
vlib/v/parser/tests/lock_var_name_assign_err.out
Normal file
3
vlib/v/parser/tests/lock_var_name_assign_err.out
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
vlib/v/parser/tests/lock_var_name_assign_err.vv:1:6: error: unexpected token `:=`, expecting one or more shared variable names
|
||||||
|
1 | lock := 12
|
||||||
|
| ~~
|
1
vlib/v/parser/tests/lock_var_name_assign_err.vv
Normal file
1
vlib/v/parser/tests/lock_var_name_assign_err.vv
Normal file
@ -0,0 +1 @@
|
|||||||
|
lock := 12
|
Loading…
x
Reference in New Issue
Block a user