Commit 3c2a32a7 authored by Sydney Acksman's avatar Sydney Acksman

Use Distinct on depended extensions to filter duplicate extensions

parent a9f390f4
......@@ -422,7 +422,8 @@ namespace Google.Protobuf.Reflection
GeneratedClrTypeInfo generatedCodeInfo)
{
ExtensionRegistry registry = new ExtensionRegistry();
AddAllExtensions(dependencies, generatedCodeInfo, registry);
registry.AddRange(GetAllExtensions(dependencies, generatedCodeInfo));
FileDescriptorProto proto;
try
{
......@@ -445,9 +446,9 @@ namespace Google.Protobuf.Reflection
}
}
private static void AddAllExtensions(FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedInfo, ExtensionRegistry registry)
private static IEnumerable<Extension> GetAllExtensions(FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedInfo)
{
registry.AddRange(dependencies.SelectMany(GetAllDependedExtensions).Concat(GetAllGeneratedExtensions(generatedInfo)).ToArray());
return dependencies.SelectMany(GetAllDependedExtensions).Distinct().Concat(GetAllGeneratedExtensions(generatedInfo));
}
private static IEnumerable<Extension> GetAllGeneratedExtensions(GeneratedClrTypeInfo generated)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment