1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: fix var name check pos

This commit is contained in:
Daniel Däschle 2020-04-14 21:27:17 +02:00 committed by GitHub
parent e1739549b2
commit 4068cbc6eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1785,7 +1785,7 @@ fn (p mut Parser) assign_stmt() ast.Stmt {
is_decl := op == .decl_assign is_decl := op == .decl_assign
for i, ident in idents { for i, ident in idents {
if op == .decl_assign && scanner.contains_capital(ident.name) { if op == .decl_assign && scanner.contains_capital(ident.name) {
p.error('variable names cannot contain uppercase letters, use snake_case instead') p.error_with_pos('variable names cannot contain uppercase letters, use snake_case instead', ident.pos)
} }
known_var := p.scope.known_var(ident.name) known_var := p.scope.known_var(ident.name)
if !is_decl && !known_var { if !is_decl && !known_var {