allow empty enums

This commit is contained in:
Dave Holoway
2020-06-16 17:51:31 +01:00
parent 9017752d7b
commit 6af16cac43

View File

@@ -641,14 +641,12 @@ function sourceType(modifiers, tokens, scope_or_pkgname, typeKind, owner, import
} }
tokens.expectValue('{'); tokens.expectValue('{');
if (type.typeKind === 'enum') { if (type.typeKind === 'enum') {
enumValueList(type, tokens, imports, typemap); if (!/[;}]/.test(tokens.current.value)) {
enumValueList(type, tokens, imports, typemap);
}
// if there are any declarations following the enum values, the values must be terminated by a semicolon // if there are any declarations following the enum values, the values must be terminated by a semicolon
switch(tokens.current.value) { if(tokens.current.value !== '}') {
case '}': semicolon(tokens);
break;
default:
semicolon(tokens);
break;
} }
} }
if (!tokens.isValue('}')) { if (!tokens.isValue('}')) {