From 36e39f2c0265f586845cee9f2347ebb20c743415 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 14 Mar 2015 01:24:18 +0100 Subject: [PATCH] add TransformStackIntoVariables for IfInstruction --- ICSharpCode.Decompiler/IL/Instructions/IfInstruction.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/IL/Instructions/IfInstruction.cs b/ICSharpCode.Decompiler/IL/Instructions/IfInstruction.cs index d3af972b9..b04afaea0 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/IfInstruction.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/IfInstruction.cs @@ -61,7 +61,14 @@ namespace ICSharpCode.Decompiler.IL internal override void TransformStackIntoVariables(TransformStackIntoVariablesState state) { - throw new NotImplementedException(); + Condition.TransformStackIntoVariables(state); + var stackAfterCondition = state.Variables.Clone(); + TrueInst.Inline(InstructionFlags.None, state).TransformStackIntoVariables(state); + var afterTrue = state.Variables.Clone(); + state.Variables = stackAfterCondition; + FalseInst.Inline(InstructionFlags.None, state).TransformStackIntoVariables(state); + if (!TrueInst.HasFlag(InstructionFlags.EndPointUnreachable) && !FalseInst.HasFlag(InstructionFlags.EndPointUnreachable)) + state.MergeVariables(state.Variables, afterTrue); } protected override InstructionFlags ComputeFlags()