mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: do not allow variable names with capital letters
This commit is contained in:
@@ -1784,6 +1784,9 @@ fn (p mut Parser) assign_stmt() ast.Stmt {
|
|||||||
exprs := p.parse_assign_rhs()
|
exprs := p.parse_assign_rhs()
|
||||||
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) {
|
||||||
|
p.error('variable names cannot contain uppercase letters, use snake_case instead')
|
||||||
|
}
|
||||||
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 {
|
||||||
p.error('unknown variable `$ident.name`')
|
p.error('unknown variable `$ident.name`')
|
||||||
|
|||||||
Reference in New Issue
Block a user