diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index 62e0465f3f..deb0a3b54b 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -254,7 +254,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl { pos := p.tok.position() // TODO high order fn name = if language == .js { p.check_js_name() } else { p.check_name() } - if language == .v && !p.pref.translated && util.contains_capital(name) && p.mod != 'builtin' { + if language == .v && !p.pref.translated && util.contains_capital(name) && !p.builtin_mod { p.error_with_pos('function names cannot contain uppercase letters, use snake_case instead', pos) return ast.FnDecl{ @@ -270,7 +270,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl { } } // cannot redefine buildin function - if !is_method && p.mod != 'builtin' && name in builtin_functions { + if !is_method && !p.builtin_mod && name in builtin_functions { p.error_with_pos('cannot redefine builtin function `$name`', pos) return ast.FnDecl{ scope: 0 diff --git a/vlib/v/parser/parse_type.v b/vlib/v/parser/parse_type.v index 95d37b8ac7..557c6db4cb 100644 --- a/vlib/v/parser/parse_type.v +++ b/vlib/v/parser/parse_type.v @@ -250,7 +250,7 @@ pub fn (mut p Parser) parse_any_type(language table.Language, is_ptr bool, check name = p.expr_mod + '.' + name } else if name in p.imported_symbols { name = p.imported_symbols[name] - } else if p.mod != 'builtin' && name.len > 1 && name !in p.table.type_idxs { + } else if !p.builtin_mod && name.len > 1 && name !in p.table.type_idxs { // `Foo` in module `mod` means `mod.Foo` name = p.mod + '.' + name } diff --git a/vlib/v/parser/struct.v b/vlib/v/parser/struct.v index f080a74108..8543ce07ee 100644 --- a/vlib/v/parser/struct.v +++ b/vlib/v/parser/struct.v @@ -65,9 +65,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl { p.error('`$p.tok.lit` lacks body') return ast.StructDecl{} } - if language == .v && - p.mod != 'builtin' && name.len > 0 && !name[0].is_capital() && !p.pref.translated - { + if language == .v && !p.builtin_mod && name.len > 0 && !name[0].is_capital() && !p.pref.translated { p.error_with_pos('struct name `$name` must begin with capital letter', name_pos) return ast.StructDecl{} }