mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: remove duplicated pascal case check
This commit is contained in:
parent
6b4fb0fc3e
commit
5e48817dc8
@ -418,8 +418,11 @@ fn stripped_name(name string) string {
|
||||
}
|
||||
|
||||
fn (mut c Checker) check_valid_pascal_case(name string, identifier string, pos token.Pos) {
|
||||
if c.pref.translated || c.file.is_translated {
|
||||
return
|
||||
}
|
||||
sname := stripped_name(name)
|
||||
if sname.len > 0 && !sname[0].is_capital() && !c.pref.translated && !c.file.is_translated {
|
||||
if sname.len > 0 && !sname[0].is_capital() {
|
||||
c.error('${identifier} `${name}` must begin with capital letter', pos)
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
vlib/v/checker/tests/incorrect_name_struct.vv:1:8: error: struct name `abc` must begin with capital letter
|
||||
vlib/v/checker/tests/incorrect_name_struct.vv:1:1: error: struct name `abc` must begin with capital letter
|
||||
1 | struct abc {}
|
||||
| ~~~
|
||||
| ~~~~~~~~~~
|
||||
|
@ -69,11 +69,6 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl {
|
||||
p.error('`${p.tok.lit}` lacks body')
|
||||
return ast.StructDecl{}
|
||||
}
|
||||
if language == .v && !p.builtin_mod && !p.is_translated && name.len > 0 && !name[0].is_capital()
|
||||
&& !p.pref.translated && !p.is_translated && !is_anon {
|
||||
p.error_with_pos('struct name `${name}` must begin with capital letter', name_pos)
|
||||
return ast.StructDecl{}
|
||||
}
|
||||
if name.len == 1 {
|
||||
p.error_with_pos('struct names must have more than one character', name_pos)
|
||||
return ast.StructDecl{}
|
||||
|
Loading…
Reference in New Issue
Block a user