internal static void AddAnonymousFields(PythonType type, List <Field> allFields, INativeType cdata, Field newField) { Field[] childFields; if (cdata is StructType) { childFields = ((StructType)cdata)._fields; } else if (cdata is UnionType) { childFields = ((UnionType)cdata)._fields; } else { throw PythonOps.TypeError("anonymous field must be struct or union"); } foreach (Field existingField in childFields) { Field anonField = new Field( existingField.FieldName, existingField.NativeType, checked (existingField.offset + newField.offset), allFields.Count ); type.AddSlot(existingField.FieldName, anonField); allFields.Add(anonField); } }