Browse Source

Extend CompoundAssignment-transformation to ldelema patterns

pull/734/head
Siegfried Pammer 9 years ago
parent
commit
fc45d47615
  1. 6
      ICSharpCode.Decompiler/IL/Transforms/ExpressionTransforms.cs

6
ICSharpCode.Decompiler/IL/Transforms/ExpressionTransforms.cs

@ -202,9 +202,13 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -202,9 +202,13 @@ namespace ICSharpCode.Decompiler.IL.Transforms
bool IsSameTarget(ILInstruction target, ILInstruction left)
{
IField f, f2;
ILInstruction t, t2;
ILInstruction t, t2, a, a2;
IType type, type2;
if (target.MatchLdFlda(out t, out f) && left.MatchLdFlda(out t2, out f2) && f.Equals(f2))
return true;
// match ldelmena(ldobj(...))
if (target.MatchLdElema(out type, out a) && left.MatchLdElema(out type2, out a2) && type.Equals(type2))
return a.MatchLdObj(out target, out type) && a2.MatchLdObj(out left, out type2) && IsSameTarget(target, left);
return false;
}

Loading…
Cancel
Save