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

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

This commit is contained in:
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

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) {
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)
}
if !c.pref.experimental && !c.pref.translated && util.contains_capital(name) {