From 6e49efd5aa8e55f68feb8c3bb378983b8d8750b6 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 2 Mar 2019 22:39:55 +0100 Subject: [PATCH] Extend ILInlining to work with StringToInt instructions inside Switch instruction. --- ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs b/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs index 59d48844f..d026a0094 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs @@ -389,7 +389,13 @@ namespace ICSharpCode.Decompiler.IL.Transforms return false; } case OpCode.SwitchInstruction: - return parent == next || (parent.MatchBinaryNumericInstruction(BinaryNumericOperator.Sub) && parent.Parent == next); + if (parent == next) + return true; + if (parent.MatchBinaryNumericInstruction(BinaryNumericOperator.Sub) && parent.Parent == next) + return true; + if (parent is StringToInt stringToInt && stringToInt.Parent == next) + return true; + return false; default: return false; }