|
|
@ -151,6 +151,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms |
|
|
|
var usages = next.Descendants.Where(d => d.MatchLdLoc(localVariable)).ToArray(); |
|
|
|
var usages = next.Descendants.Where(d => d.MatchLdLoc(localVariable)).ToArray(); |
|
|
|
if (usages.Length != 1) |
|
|
|
if (usages.Length != 1) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
if (binary.IsLifted) |
|
|
|
|
|
|
|
return false; |
|
|
|
context.Step($"Compound assignment to '{owner.Name}'", setterCall); |
|
|
|
context.Step($"Compound assignment to '{owner.Name}'", setterCall); |
|
|
|
block.Instructions.RemoveAt(i + 1); |
|
|
|
block.Instructions.RemoveAt(i + 1); |
|
|
|
block.Instructions.RemoveAt(i); |
|
|
|
block.Instructions.RemoveAt(i); |
|
|
@ -230,6 +232,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms |
|
|
|
var binary = nextInst.Value as BinaryNumericInstruction; |
|
|
|
var binary = nextInst.Value as BinaryNumericInstruction; |
|
|
|
if (inst.Variable.Kind != VariableKind.StackSlot || nextInst.Variable.Kind == VariableKind.StackSlot || binary == null) |
|
|
|
if (inst.Variable.Kind != VariableKind.StackSlot || nextInst.Variable.Kind == VariableKind.StackSlot || binary == null) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
if (binary.IsLifted) |
|
|
|
|
|
|
|
return false; |
|
|
|
if ((binary.Operator != BinaryNumericOperator.Add && binary.Operator != BinaryNumericOperator.Sub) || !binary.Left.MatchLdLoc(inst.Variable) || !binary.Right.MatchLdcI4(1)) |
|
|
|
if ((binary.Operator != BinaryNumericOperator.Add && binary.Operator != BinaryNumericOperator.Sub) || !binary.Left.MatchLdLoc(inst.Variable) || !binary.Right.MatchLdcI4(1)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
context.Step($"TransformPostIncDecOperator", inst); |
|
|
|
context.Step($"TransformPostIncDecOperator", inst); |
|
|
@ -269,6 +273,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms |
|
|
|
if (binary == null || !binary.Left.MatchLdLoc(nextInst.Variable) || !binary.Right.MatchLdcI4(1) |
|
|
|
if (binary == null || !binary.Left.MatchLdLoc(nextInst.Variable) || !binary.Right.MatchLdcI4(1) |
|
|
|
|| (binary.Operator != BinaryNumericOperator.Add && binary.Operator != BinaryNumericOperator.Sub)) |
|
|
|
|| (binary.Operator != BinaryNumericOperator.Add && binary.Operator != BinaryNumericOperator.Sub)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
if (binary.IsLifted) |
|
|
|
|
|
|
|
return false; |
|
|
|
context.Step($"TransformPostIncDecOperator", inst); |
|
|
|
context.Step($"TransformPostIncDecOperator", inst); |
|
|
|
var assignment = new CompoundAssignmentInstruction(binary.Operator, new LdObj(inst.Value, targetType), binary.Right, targetType, binary.CheckForOverflow, binary.Sign, CompoundAssignmentType.EvaluatesToOldValue); |
|
|
|
var assignment = new CompoundAssignmentInstruction(binary.Operator, new LdObj(inst.Value, targetType), binary.Right, targetType, binary.CheckForOverflow, binary.Sign, CompoundAssignmentType.EvaluatesToOldValue); |
|
|
|
stobj.ReplaceWith(new StLoc(nextInst.Variable, assignment)); |
|
|
|
stobj.ReplaceWith(new StLoc(nextInst.Variable, assignment)); |
|
|
@ -319,6 +325,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms |
|
|
|
if (binary == null || !binary.Left.MatchLdLoc(fieldValue.Variable) || !binary.Right.MatchLdcI4(1) |
|
|
|
if (binary == null || !binary.Left.MatchLdLoc(fieldValue.Variable) || !binary.Right.MatchLdcI4(1) |
|
|
|
|| (binary.Operator != BinaryNumericOperator.Add && binary.Operator != BinaryNumericOperator.Sub)) |
|
|
|
|| (binary.Operator != BinaryNumericOperator.Add && binary.Operator != BinaryNumericOperator.Sub)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
if (binary.IsLifted) |
|
|
|
|
|
|
|
return false; |
|
|
|
context.Step($"TransformCSharp4PostIncDecOperatorOnAddress", baseFieldAddress); |
|
|
|
context.Step($"TransformCSharp4PostIncDecOperatorOnAddress", baseFieldAddress); |
|
|
|
var assignment = new CompoundAssignmentInstruction(binary.Operator, new LdObj(baseAddress, t), binary.Right, t, binary.CheckForOverflow, binary.Sign, CompoundAssignmentType.EvaluatesToOldValue); |
|
|
|
var assignment = new CompoundAssignmentInstruction(binary.Operator, new LdObj(baseAddress, t), binary.Right, t, binary.CheckForOverflow, binary.Sign, CompoundAssignmentType.EvaluatesToOldValue); |
|
|
|
stobj.ReplaceWith(new StLoc(fieldValueCopyToLocal.Variable, assignment)); |
|
|
|
stobj.ReplaceWith(new StLoc(fieldValueCopyToLocal.Variable, assignment)); |
|
|
@ -349,6 +357,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms |
|
|
|
var binary = stobj.Value as BinaryNumericInstruction; |
|
|
|
var binary = stobj.Value as BinaryNumericInstruction; |
|
|
|
if (binary == null || !binary.Left.MatchLdLoc(inst.Variable) || !binary.Right.MatchLdcI4(1)) |
|
|
|
if (binary == null || !binary.Left.MatchLdLoc(inst.Variable) || !binary.Right.MatchLdcI4(1)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
if (binary.IsLifted) |
|
|
|
|
|
|
|
return false; |
|
|
|
context.Step($"TransformPostIncDecOnStaticField", inst); |
|
|
|
context.Step($"TransformPostIncDecOnStaticField", inst); |
|
|
|
var assignment = new CompoundAssignmentInstruction(binary.Operator, inst.Value, binary.Right, type, binary.CheckForOverflow, binary.Sign, CompoundAssignmentType.EvaluatesToOldValue); |
|
|
|
var assignment = new CompoundAssignmentInstruction(binary.Operator, inst.Value, binary.Right, type, binary.CheckForOverflow, binary.Sign, CompoundAssignmentType.EvaluatesToOldValue); |
|
|
|
stobj.ReplaceWith(new StLoc(inst.Variable, assignment)); |
|
|
|
stobj.ReplaceWith(new StLoc(inst.Variable, assignment)); |
|
|
|