|
|
|
@ -86,13 +86,15 @@ namespace ICSharpCode.Decompiler.CSharp
@@ -86,13 +86,15 @@ namespace ICSharpCode.Decompiler.CSharp
|
|
|
|
|
CollectNamespacesForTypeReference(param.Type, namespaces); |
|
|
|
|
} |
|
|
|
|
HandleTypeParameters(method.TypeParameters, namespaces); |
|
|
|
|
if (!method.MetadataToken.IsNil && method.HasBody) { |
|
|
|
|
if (!method.MetadataToken.IsNil) { |
|
|
|
|
if (mappingInfo == null) |
|
|
|
|
mappingInfo = CSharpDecompiler.GetCodeMappingInfo(entity.ParentModule.PEFile, entity.MetadataToken); |
|
|
|
|
var reader = module.PEFile.Reader; |
|
|
|
|
var parts = mappingInfo.GetMethodParts((MethodDefinitionHandle)method.MetadataToken).ToList(); |
|
|
|
|
foreach (var part in parts) { |
|
|
|
|
HandleOverrides(part.GetMethodImplementations(module.metadata), module, namespaces); |
|
|
|
|
var methodDef = module.metadata.GetMethodDefinition(part); |
|
|
|
|
if (method.HasBody) { |
|
|
|
|
MethodBodyBlock body; |
|
|
|
|
try { |
|
|
|
|
body = reader.GetMethodBody(methodDef.RelativeVirtualAddress); |
|
|
|
@ -102,6 +104,7 @@ namespace ICSharpCode.Decompiler.CSharp
@@ -102,6 +104,7 @@ namespace ICSharpCode.Decompiler.CSharp
|
|
|
|
|
CollectNamespacesFromMethodBody(body, module, namespaces); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case IProperty property: |
|
|
|
|
HandleAttributes(property.GetAttributes(), namespaces); |
|
|
|
@ -116,6 +119,16 @@ namespace ICSharpCode.Decompiler.CSharp
@@ -116,6 +119,16 @@ namespace ICSharpCode.Decompiler.CSharp
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void HandleOverrides(ImmutableArray<MethodImplementationHandle> immutableArray, MetadataModule module, HashSet<string> namespaces) |
|
|
|
|
{ |
|
|
|
|
foreach (var h in immutableArray) { |
|
|
|
|
var methodImpl = module.metadata.GetMethodImplementation(h); |
|
|
|
|
CollectNamespacesForTypeReference(module.ResolveType(methodImpl.Type, genericContext), namespaces); |
|
|
|
|
CollectNamespacesForMemberReference(module.ResolveMethod(methodImpl.MethodBody, genericContext), module, namespaces); |
|
|
|
|
CollectNamespacesForMemberReference(module.ResolveMethod(methodImpl.MethodDeclaration, genericContext), module, namespaces); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void CollectNamespacesForTypeReference(IType type, HashSet<string> namespaces) |
|
|
|
|
{ |
|
|
|
|
switch (type) { |
|
|
|
|