checker: warn/error about empty const blocks (#9252)
parent
5cfe55b7e8
commit
8f08795689
|
@ -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…
Reference in New Issue