Browse Source

Fix use of Clone in NullCoalescingTransform

pull/734/merge
Siegfried Pammer 8 years ago
parent
commit
bcaf6db313
  1. 4
      ICSharpCode.Decompiler/IL/Transforms/NullCoalescingTransform.cs

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

@ -45,7 +45,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -45,7 +45,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
/// stloc s(fallbackInst)
/// }
/// =>
/// stloc s(if.notnull(valueInst, fallbackInst)
/// stloc s(if.notnull(valueInst, fallbackInst))
/// </summary>
bool TransformNullCoalescing(Block block, int i)
{
@ -57,7 +57,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -57,7 +57,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (!ifInstruction.FalseInst.MatchNop() || !(ifInstruction.TrueInst is Block b) || b.Instructions.Count != 1 || !(b.Instructions[0] is StLoc fallbackStore) || fallbackStore.Variable != stloc.Variable)
return false;
context.Step("TransformNullCoalescing", stloc);
stloc.Value.ReplaceWith(new NullCoalescingInstruction(stloc.Value.Clone(), fallbackStore.Value.Clone()));
stloc.Value = new NullCoalescingInstruction(stloc.Value, fallbackStore.Value);
return true;
}
}

Loading…
Cancel
Save