checker: relax naming requirements for translated code (#10619)

pull/10630/head
div72 2021-06-30 14:47:13 +03:00 committed by GitHub
parent e108a67952
commit 9d02ca51d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -296,7 +296,8 @@ fn (mut c Checker) file_has_main_fn(file &ast.File) bool {
} }
fn (mut c Checker) check_valid_snake_case(name string, identifier string, pos token.Position) { fn (mut c Checker) check_valid_snake_case(name string, identifier string, pos token.Position) {
if !c.pref.is_vweb && name.len > 0 && (name[0] == `_` || name.contains('._')) { if !c.pref.is_vweb && !c.pref.translated && name.len > 0
&& (name[0] == `_` || name.contains('._')) {
c.error('$identifier `$name` cannot start with `_`', pos) c.error('$identifier `$name` cannot start with `_`', pos)
} }
if !c.pref.experimental && !c.pref.translated && util.contains_capital(name) { if !c.pref.experimental && !c.pref.translated && util.contains_capital(name) {