From e4fda5c2e4aad84ef87624e9fbd04bb343c06a3f Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Wed, 26 Feb 2020 10:31:27 +0100 Subject: [PATCH] Rename HasILRange to ILRangeIsEmpty to properly reflect its implementation. --- ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs | 2 +- ICSharpCode.Decompiler/IL/BlockBuilder.cs | 4 ++-- ICSharpCode.Decompiler/IL/ControlFlow/ConditionDetection.cs | 4 ++-- .../IL/ControlFlow/ControlFlowSimplification.cs | 4 ++-- ICSharpCode.Decompiler/IL/Instructions/BlockContainer.cs | 2 +- ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs b/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs index b652e6ebe..d843be17f 100644 --- a/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs @@ -275,7 +275,7 @@ namespace ICSharpCode.Decompiler.CSharp internal static bool HasUsableILRange(ILInstruction inst) { - if (inst.HasILRange) + if (inst.ILRangeIsEmpty) return false; return !(inst is BlockContainer || inst is Block); } diff --git a/ICSharpCode.Decompiler/IL/BlockBuilder.cs b/ICSharpCode.Decompiler/IL/BlockBuilder.cs index 49edd9ef0..bd59b8f7c 100644 --- a/ICSharpCode.Decompiler/IL/BlockBuilder.cs +++ b/ICSharpCode.Decompiler/IL/BlockBuilder.cs @@ -137,7 +137,7 @@ namespace ICSharpCode.Decompiler.IL // this container is skipped (i.e. the loop will execute again) // set ILRange to the last instruction offset inside the block. if (start >= currentContainer.EndILOffset) { - Debug.Assert(currentBlock.HasILRange); + Debug.Assert(currentBlock.ILRangeIsEmpty); currentBlock.AddILRange(new Interval(currentBlock.StartILOffset, start)); } } @@ -190,7 +190,7 @@ namespace ICSharpCode.Decompiler.IL { if (currentBlock == null) return; - Debug.Assert(currentBlock.HasILRange); + Debug.Assert(currentBlock.ILRangeIsEmpty); currentBlock.SetILRange(new Interval(currentBlock.StartILOffset, currentILOffset)); if (fallthrough) { if (currentBlock.Instructions.LastOrDefault() is SwitchInstruction switchInst && switchInst.Sections.Last().Body.MatchNop()) { diff --git a/ICSharpCode.Decompiler/IL/ControlFlow/ConditionDetection.cs b/ICSharpCode.Decompiler/IL/ControlFlow/ConditionDetection.cs index bb7a120b1..86de21751 100644 --- a/ICSharpCode.Decompiler/IL/ControlFlow/ConditionDetection.cs +++ b/ICSharpCode.Decompiler/IL/ControlFlow/ConditionDetection.cs @@ -442,11 +442,11 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow // some compilers merge the leave instructions for different arguments using stack variables // these get split and inlined, but the ILRange of the value remains a better indicator of the actual location if (inst is Leave leave && !leave.Value.MatchNop()) { - isEmpty = leave.Value.HasILRange; + isEmpty = leave.Value.ILRangeIsEmpty; return leave.Value.StartILOffset; } - isEmpty = inst.HasILRange; + isEmpty = inst.ILRangeIsEmpty; return inst.StartILOffset; } diff --git a/ICSharpCode.Decompiler/IL/ControlFlow/ControlFlowSimplification.cs b/ICSharpCode.Decompiler/IL/ControlFlow/ControlFlowSimplification.cs index 1f8233b6b..ee9700691 100644 --- a/ICSharpCode.Decompiler/IL/ControlFlow/ControlFlowSimplification.cs +++ b/ICSharpCode.Decompiler/IL/ControlFlow/ControlFlowSimplification.cs @@ -166,7 +166,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow context.Step("Replace branch to leave with leave", branch); // Replace branches to 'leave' instruction with the leave instruction var leave2 = leave.Clone(); - if (!branch.HasILRange) // use the ILRange of the branch if possible + if (!branch.ILRangeIsEmpty) // use the ILRange of the branch if possible leave2.AddILRange(branch); branch.ReplaceWith(leave2); } @@ -221,7 +221,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow block.Instructions.RemoveRange(block.Instructions.Count - 3, 2); } - if (block.HasILRange) + if (block.ILRangeIsEmpty) block.AddILRange(targetBlock); block.Instructions.Remove(br); diff --git a/ICSharpCode.Decompiler/IL/Instructions/BlockContainer.cs b/ICSharpCode.Decompiler/IL/Instructions/BlockContainer.cs index b824794a2..623aa9189 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/BlockContainer.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/BlockContainer.cs @@ -181,7 +181,7 @@ namespace ICSharpCode.Decompiler.IL base.CheckInvariant(phase); Debug.Assert(Blocks.Count > 0 && EntryPoint == Blocks[0]); Debug.Assert(!IsConnected || EntryPoint?.IncomingEdgeCount >= 1); - Debug.Assert(EntryPoint == null || Parent is ILFunction || !HasILRange); + Debug.Assert(EntryPoint == null || Parent is ILFunction || !ILRangeIsEmpty); Debug.Assert(Blocks.All(b => b.HasFlag(InstructionFlags.EndPointUnreachable))); Debug.Assert(Blocks.All(b => b.Kind == BlockKind.ControlFlow)); // this also implies that the blocks don't use FinalInstruction Debug.Assert(TopologicalSort(deleteUnreachableBlocks: true).Count == Blocks.Count, "Container should not have any unreachable blocks"); diff --git a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs index 789634a57..c35c701ee 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs @@ -253,7 +253,7 @@ namespace ICSharpCode.Decompiler.IL public int EndILOffset => ILRange.End; - public bool HasILRange => ILRange.IsEmpty; + public bool ILRangeIsEmpty => ILRange.IsEmpty; public IEnumerable ILRanges => new[] { ILRange };