Browse Source

RequiredNamespaceCollector: Fix missing imports on generic parameters.

pull/1198/head
Siegfried Pammer 7 years ago
parent
commit
9680abdf0e
  1. 8
      ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs

8
ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs

@ -35,6 +35,10 @@ namespace ICSharpCode.Decompiler.CSharp @@ -35,6 +35,10 @@ namespace ICSharpCode.Decompiler.CSharp
namespaces.Add(td.Namespace);
HandleAttributes(td.Attributes, namespaces);
foreach (var typeParam in td.TypeParameters) {
HandleAttributes(typeParam.Attributes, namespaces);
}
foreach (var baseType in td.DirectBaseTypes) {
CollectNamespacesForTypeReference(baseType, namespaces);
}
@ -67,8 +71,12 @@ namespace ICSharpCode.Decompiler.CSharp @@ -67,8 +71,12 @@ namespace ICSharpCode.Decompiler.CSharp
HandleAttributes(method.Attributes, namespaces);
CollectNamespacesForTypeReference(method.ReturnType, namespaces);
foreach (var param in method.Parameters) {
HandleAttributes(param.Attributes, namespaces);
CollectNamespacesForTypeReference(param.Type, namespaces);
}
foreach (var typeParam in method.TypeParameters) {
HandleAttributes(typeParam.Attributes, namespaces);
}
if (!method.MetadataToken.IsNil && method.HasBody) {
var reader = typeSystem.ModuleDefinition.Reader;
var methodDef = typeSystem.ModuleDefinition.GetMetadataReader().GetMethodDefinition((MethodDefinitionHandle)method.MetadataToken);

Loading…
Cancel
Save