parser: struct names must be capitalized
parent
a4cbe78d97
commit
9eac16b976
|
@ -678,7 +678,8 @@ fn (v mut V) add_v_files_to_compile() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
mod_path := v.find_module_path(mod)
|
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
|
// TmpPath/vlib
|
||||||
// These were generated by vfmt
|
// These were generated by vfmt
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -606,6 +606,9 @@ fn (p mut Parser) struct_decl() {
|
||||||
if name.contains('_') && !p.pref.translated {
|
if name.contains('_') && !p.pref.translated {
|
||||||
p.error('type names cannot contain `_`')
|
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') {
|
if is_interface && !name.ends_with('er') {
|
||||||
p.error('interface names temporarily have to end with `er` (e.g. `Speaker`, `Reader`)')
|
p.error('interface names temporarily have to end with `er` (e.g. `Speaker`, `Reader`)')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue