+func getSizeOfField(field *Field) (size int, isBaseType bool) {
+ if alias := field.TypeAlias; alias != nil {
+ size = getSizeOfBinapiBaseType(alias.Type, alias.Length)
+ return
+ }
+ if enum := field.TypeEnum; enum != nil {
+ size = getSizeOfBinapiBaseType(enum.Type, field.Length)
+ return
+ }
+ if structType := field.TypeStruct; structType != nil {
+ size = getSizeOfStruct(structType)
+ return
+ }
+ if union := field.TypeUnion; union != nil {
+ size = getUnionSize(union)
+ return
+ }
+ return size, true
+}
+
+func getSizeOfStruct(typ *Struct) (size int) {