From fc9ee0ff90d44e96e5b9b18e8512b3d8765bd05d Mon Sep 17 00:00:00 2001 From: mohe2015 Date: Thu, 12 Oct 2017 21:46:12 +0200 Subject: [PATCH] Add comments for clarification. --- .../IL/Transforms/DetectCatchWhenConditionBlocks.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ICSharpCode.Decompiler/IL/Transforms/DetectCatchWhenConditionBlocks.cs b/ICSharpCode.Decompiler/IL/Transforms/DetectCatchWhenConditionBlocks.cs index 49c579708..872d0acd7 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/DetectCatchWhenConditionBlocks.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/DetectCatchWhenConditionBlocks.cs @@ -42,6 +42,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms // } var instructions = container.EntryPoint.Instructions; if (instructions.Count == 3) { + // stloc temp(isinst exceptionType(ldloc exceptionVar)) + // if (comp(ldloc temp != ldnull)) br whenConditionBlock + // br falseBlock ((StLoc)instructions[0]).Value = exceptionSlot; instructions[1].ReplaceWith(new Branch(whenConditionBlock)); instructions.RemoveAt(2); @@ -72,6 +75,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms if (entryPoint == null || entryPoint.IncomingEdgeCount != 1) return false; if (entryPoint.Instructions.Count == 3) { + // stloc temp(isinst exceptionType(ldloc exceptionVar)) + // if (comp(ldloc temp != ldnull)) br whenConditionBlock + // br falseBlock if (!entryPoint.Instructions[0].MatchStLoc(out var temp, out var isinst) || temp.Kind != VariableKind.StackSlot || !isinst.MatchIsInst(out exceptionSlot, out exceptionType)) return false;