Browse Source

Rename BlockType.CompoundOperator to PostfixOperator

pull/832/head
Siegfried Pammer 8 years ago
parent
commit
bc33fa54e9
  1. 2
      ICSharpCode.Decompiler/IL/Instructions/Block.cs
  2. 4
      ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs

2
ICSharpCode.Decompiler/IL/Instructions/Block.cs

@ -241,6 +241,6 @@ namespace ICSharpCode.Decompiler.IL @@ -241,6 +241,6 @@ namespace ICSharpCode.Decompiler.IL
ArrayInitializer,
CollectionInitializer,
ObjectInitializer,
CompoundOperator
PostfixOperator
}
}

4
ICSharpCode.Decompiler/IL/Transforms/TransformAssignment.cs

@ -225,7 +225,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -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 @@ -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);

Loading…
Cancel
Save