Browse Source

Remove ILInstructionExtensions.cs

pull/900/head
Siegfried Pammer 8 years ago
parent
commit
f8b27066a1
  1. 1
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
  2. 2
      ICSharpCode.Decompiler/IL/ControlFlow/ConditionDetection.cs
  3. 20
      ICSharpCode.Decompiler/IL/Instructions/ILInstructionExtensions.cs

1
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -275,7 +275,6 @@ @@ -275,7 +275,6 @@
<Compile Include="DotNetCore\DotNetCorePathFinder.cs" />
<Compile Include="DotNetCore\DotNetCorePathFinderExtensions.cs" />
<Compile Include="DotNetCore\UnresolvedAssemblyNameReference.cs" />
<Compile Include="IL\Instructions\ILInstructionExtensions.cs" />
<Compile Include="IL\ILAstWritingOptions.cs" />
<Compile Include="IL\SequencePoint.cs" />
<Compile Include="IL\Instructions\CallIndirect.cs" />

2
ICSharpCode.Decompiler/IL/ControlFlow/ConditionDetection.cs

@ -174,7 +174,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -174,7 +174,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
// -> if (...) { ... } else { ... } goto exitPoint;
// the else block is not empty or nop-only:
if (!targetBlock.IsNopBlock(ignoreExitPoint: falseExitInst)) {
if (targetBlock.Children.Any(inst => !(inst is Nop) && inst != falseExitInst)) {
context.Step("Inline block as else-branch", ifInst);
targetBlock.Instructions.RemoveAt(targetBlock.Instructions.Count - 1);
targetBlock.Remove();

20
ICSharpCode.Decompiler/IL/Instructions/ILInstructionExtensions.cs

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace ICSharpCode.Decompiler.IL
{
public static class ILInstructionExtensions
{
/// <summary>
/// Determines whether a block only consists of nop instructions or is empty.
/// </summary>
public static bool IsNopBlock(this Block block, ILInstruction ignoreExitPoint = null)
{
if (block == null)
throw new ArgumentNullException(nameof(block));
return block.Children.Count(i => !(i is Nop) && i != ignoreExitPoint) == 0;
}
}
}
Loading…
Cancel
Save