Skip to content

Commit 3720b2b

Browse files
authored
fix(metadata-generator): skip empty bitfields (#178)
1 parent 6ee354c commit 3720b2b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

metadata-generator/src/TypeScript/DefinitionWriter.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,11 @@ std::string DefinitionWriter::writeProperty(PropertyMeta* meta, BaseClassMeta* o
654654
return std::string();
655655
}
656656

657+
// prevent writing out empty property names
658+
if (meta->jsName.length() == 0) {
659+
return std::string();
660+
}
661+
657662
output << meta->jsName;
658663
if (owner->is(MetaType::Protocol) && clang::dyn_cast<clang::ObjCPropertyDecl>(meta->declaration)->getPropertyImplementation() == clang::ObjCPropertyDecl::PropertyControl::Optional) {
659664
output << "?";
@@ -751,6 +756,13 @@ void DefinitionWriter::writeMembers(const std::vector<RecordField>& fields, std:
751756
if (i < fieldsComments.size()) {
752757
_buffer << fieldsComments[i].toString("\t");
753758
}
759+
760+
// prevent writing empty field names,
761+
// fixes issue with structs containing emtpy bitfields (ie. __darwin_fp_control)
762+
if(fields[i].name.length() == 0) {
763+
continue;
764+
}
765+
754766
_buffer << "\t" << fields[i].name << ": " << tsifyType(*fields[i].encoding) << ";" << std::endl;
755767
}
756768
}

0 commit comments

Comments
 (0)