datalibrary change

mail@pastecode.io avatar
unknown
diff
3 years ago
852 B
4
Indexable
Never
diff -r 957609419922 datalibrary/src/dl_typelib_write_c_header.cpp
--- a/datalibrary/src/dl_typelib_write_c_header.cpp	Wed Jan 27 17:35:35 2021 +0100
+++ b/datalibrary/src/dl_typelib_write_c_header.cpp	Fri Jan 29 15:43:46 2021 +0100
@@ -610,6 +610,14 @@
 		case DL_TYPE_ATOM_INLINE_ARRAY:
 		{
 			dl_binary_writer_write_string_fmt(writer, "    ");
+
+			// If a member is marked as a struct it could also have been an enum that we didn't know about parse-time, patch it in that case.
+			if( member->storage == DL_TYPE_STORAGE_STRUCT )
+			{
+				if( const dl_enum_desc* edesc = dl_internal_find_enum( ctx, member->type_id ) )
+					member->storage = edesc->storage;
+			}
+
 			dl_context_write_type(ctx, member->storage, member->type_id, writer);
 			dl_binary_writer_write_string_fmt( writer, " %s[%u];\n", member->name, member->array_count );
 		}