Browse Source

Cleanup

pull/1030/head
Siegfried Pammer 7 years ago
parent
commit
78dab4f44b
  1. 1
      ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs
  2. 7
      ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs

1
ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs

@ -138,6 +138,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -138,6 +138,7 @@ namespace ICSharpCode.Decompiler.CSharp
public static void CollectNamespaces(EntityHandle entity, DecompilerTypeSystem typeSystem, HashSet<string> namespaces)
{
if (entity.IsNil) return;
if (entity.Kind.IsTypeKind()) {
CollectNamespaces(typeSystem.ResolveAsType(entity).GetDefinition(), typeSystem, namespaces);
} else {

7
ICSharpCode.Decompiler/IL/Transforms/DelegateConstruction.cs

@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// TODO : it is probably not a good idea to remove *all* display-classes
// is there a way to minimize the false-positives?
if (newObj != null && IsInSimpleDisplayClass(newObj.Method)) {
targetVariable.CaptureScope = FindBlockContainer(block);
targetVariable.CaptureScope = BlockContainer.FindClosestContainer(block);
targetsToReplace.Add((IInstructionWithVariableOperand)block.Instructions[i]);
translatedDisplayClasses.Add(newObj.Method.DeclaringTypeDefinition);
}
@ -72,11 +72,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -72,11 +72,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms
}
}
private BlockContainer FindBlockContainer(Block block)
{
return BlockContainer.FindClosestContainer(block) ?? throw new NotSupportedException();
}
static bool IsInSimpleDisplayClass(IMethod method)
{
if (!method.IsCompilerGeneratedOrIsInCompilerGeneratedClass())

Loading…
Cancel
Save