Api constant rendering

This commit is contained in:
Robin Voetter
2020-06-16 19:24:39 +02:00
parent a6db3db211
commit df886c5167
5 changed files with 94 additions and 18 deletions

View File

@@ -139,7 +139,9 @@ const DeclarationResolver = struct {
var write_index: usize = 0;
while (read_index < self.registry.decls.len) {
const decl = self.registry.decls[read_index];
if (decl.decl_type == .foreign or self.declarations.contains(decl.name)) {
const is_required = self.declarations.contains(decl.name);
const is_empty_enum = decl.decl_type == .enumeration and decl.decl_type.enumeration.fields.len == 0;
if (decl.decl_type == .foreign or (is_required and !is_empty_enum)) {
self.registry.decls[write_index] = decl;
write_index += 1;
}