mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
force snake_case in variable names
This commit is contained in:
parent
100bcc2034
commit
840e496a51
5 changed files with 33 additions and 30 deletions
|
@ -1152,6 +1152,9 @@ fn (p mut Parser) var_decl() {
|
|||
v := p.cur_fn.find_var(name)
|
||||
p.error('redefinition of `$name`')
|
||||
}
|
||||
if name.len > 1 && contains_capital(name) {
|
||||
p.error('variable names cannot contain uppercase letters, use snake_case instead')
|
||||
}
|
||||
p.check_space(.decl_assign) // :=
|
||||
// Generate expression to tmp because we need its type first
|
||||
// [TYP .name =] bool_expression()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue