Browse Source

Throw NotImplementedException when attempting to clone a VariableScope.

pull/728/merge
Daniel Grunwald 9 years ago
parent
commit
2663416fb6
  1. 1
      ICSharpCode.Decompiler/IL/Instructions.cs
  2. 6
      ICSharpCode.Decompiler/IL/Instructions.tt
  3. 6
      ICSharpCode.Decompiler/IL/Instructions/VariableScope.cs

1
ICSharpCode.Decompiler/IL/Instructions.cs

@ -514,6 +514,7 @@ namespace ICSharpCode.Decompiler.IL @@ -514,6 +514,7 @@ namespace ICSharpCode.Decompiler.IL
{
var clone = (ILFunction)ShallowClone();
clone.Body = this.body.Clone();
clone.CloneVariables();
return clone;
}
public override StackType ResultType { get { return StackType.O; } }

6
ICSharpCode.Decompiler/IL/Instructions.tt

@ -711,8 +711,12 @@ namespace ICSharpCode.Decompiler.IL @@ -711,8 +711,12 @@ namespace ICSharpCode.Decompiler.IL
if (children[i].IsCollection) {
b.AppendLine("\tclone." + children[i].PropertyName + " = new InstructionCollection<ILInstruction>(clone, " + i + ");");
b.AppendLine("\tclone." + children[i].PropertyName + ".AddRange(this." + children[i].PropertyName + ".Select(arg => arg.Clone()));");
} else
} else {
b.AppendLine("\tclone." + children[i].PropertyName + " = this." + children[i].Name + ".Clone();");
}
}
if (opCode.Name == "ILFunction") {
b.AppendLine("\tclone.CloneVariables();");
}
b.AppendLine("\treturn clone;");
b.Append("}");

6
ICSharpCode.Decompiler/IL/Instructions/VariableScope.cs

@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace ICSharpCode.Decompiler.IL
{
@ -42,6 +43,11 @@ namespace ICSharpCode.Decompiler.IL @@ -42,6 +43,11 @@ namespace ICSharpCode.Decompiler.IL
}
base.CheckInvariant(phase);
}
protected void CloneVariables()
{
throw new NotImplementedException();
}
}
/// <summary>

Loading…
Cancel
Save