1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: fix stuck parsing of 'enum{}' + handle such bugs

This commit is contained in:
Delyan Angelov
2020-01-21 19:47:52 +02:00
committed by Alexander Medvednikov
parent ae3d84df6b
commit f4834bd85d
3 changed files with 38 additions and 4 deletions

View File

@@ -106,13 +106,16 @@ int typ;
} $enum_name;
'
}
// Skip empty enums
// Skip nameless enums
else if !no_name && !p.first_pass() {
p.cgen.typedefs << 'typedef int $enum_name;'
}
}
p.check(.rcbr)
p.fgen_nl()
p.fgen_nl()
if !no_name && fields.len == 0 {
p.error('Empty enums are not allowed.')
}
}
fn (p mut Parser) check_enum_member_access() {