mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: struct names must be capitalized
This commit is contained in:
parent
a4cbe78d97
commit
9eac16b976
@ -678,7 +678,8 @@ fn (v mut V) add_v_files_to_compile() {
|
||||
continue
|
||||
}
|
||||
mod_path := v.find_module_path(mod)
|
||||
// If we are in default mode, we don't parse vlib .v files, but header .vh files in
|
||||
// If we are in default mode, we don't parse vlib .v files, but
|
||||
// header .vh files in
|
||||
// TmpPath/vlib
|
||||
// These were generated by vfmt
|
||||
/*
|
||||
|
@ -606,6 +606,9 @@ fn (p mut Parser) struct_decl() {
|
||||
if name.contains('_') && !p.pref.translated {
|
||||
p.error('type names cannot contain `_`')
|
||||
}
|
||||
if !p.builtin_mod && !name[0].is_capital() {
|
||||
p.error('struct names must be capitalized: `struct Foo {`, not `struct foo {`')
|
||||
}
|
||||
if is_interface && !name.ends_with('er') {
|
||||
p.error('interface names temporarily have to end with `er` (e.g. `Speaker`, `Reader`)')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user