diff --git a/ICSharpCode.Decompiler/IL/Instructions/Block.cs b/ICSharpCode.Decompiler/IL/Instructions/Block.cs index fca3ae5be..6ab8d9db3 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/Block.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/Block.cs @@ -241,6 +241,6 @@ namespace ICSharpCode.Decompiler.IL ArrayInitializer, CollectionInitializer, ObjectInitializer, - CompoundOperator + PostfixOperator } } diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs index 81a335a5c..2e3647722 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs @@ -225,7 +225,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms { var inst = block.Instructions[i] as StLoc; var nextInst = block.Instructions.ElementAtOrDefault(i + 1) as StLoc; - if (inst == null || nextInst == null) + if (inst == null || nextInst == null || !inst.Value.MatchLdLoc(out var l) || !ILVariableEqualityComparer.Instance.Equals(l, nextInst.Variable)) return false; var binary = nextInst.Value as BinaryNumericInstruction; if (inst.Variable.Kind != VariableKind.StackSlot || nextInst.Variable.Kind == VariableKind.StackSlot || binary == null) @@ -234,7 +234,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms return false; context.Step($"TransformPostIncDecOperator", inst); var tempStore = context.Function.RegisterVariable(VariableKind.StackSlot, inst.Variable.Type); - var assignment = new Block(BlockType.CompoundOperator); + var assignment = new Block(BlockType.PostfixOperator); assignment.Instructions.Add(new StLoc(tempStore, new LdLoc(nextInst.Variable))); assignment.Instructions.Add(new StLoc(nextInst.Variable, new BinaryNumericInstruction(binary.Operator, new LdLoc(tempStore), new LdcI4(1), binary.CheckForOverflow, binary.Sign))); assignment.FinalInstruction = new LdLoc(tempStore);