mirror of https://github.com/icsharpcode/ILSpy.git
3 changed files with 34 additions and 4 deletions
@ -0,0 +1,20 @@ |
|||||||
|
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…
Reference in new issue