mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
checker: warn/error about empty const blocks (#9252)
This commit is contained in:
parent
5cfe55b7e8
commit
8f08795689
1 changed files with 3 additions and 0 deletions
|
@ -2442,6 +2442,9 @@ pub fn (mut c Checker) return_stmt(mut return_stmt ast.Return) {
|
|||
pub fn (mut c Checker) const_decl(mut node ast.ConstDecl) {
|
||||
mut field_names := []string{}
|
||||
mut field_order := []int{}
|
||||
if node.fields.len == 0 {
|
||||
c.warn('const block must have at least 1 declaration', node.pos)
|
||||
}
|
||||
for i, field in node.fields {
|
||||
// TODO Check const name once the syntax is decided
|
||||
if field.name in c.const_names {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue