Browse Source

Merge branch 'newdecompiler' of github.com:icsharpcode/ILSpy into newdecompiler

pull/734/head
Siegfried Pammer 9 years ago
parent
commit
4852905337
  1. 3
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  2. 7
      ICSharpCode.Decompiler/IL/ILVariable.cs
  3. 2
      ICSharpCode.Decompiler/IL/Transforms/CopyPropagation.cs
  4. 4
      ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

3
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -60,7 +60,7 @@ namespace ICSharpCode.Decompiler.CSharp
new ConditionDetection(),
new ILInlining(),
new TransformInlineAssignment(),
// new CopyPropagation(),
new CopyPropagation(),
new InlineCompilerGeneratedVariables(),
new ExpressionTransforms(), // must run once before "the loop" to allow RemoveDeadVariablesInit
new RemoveDeadVariableInit(), // must run after ExpressionTransforms because it does not handle stobj(ldloca V, ...)
@ -74,7 +74,6 @@ namespace ICSharpCode.Decompiler.CSharp @@ -74,7 +74,6 @@ namespace ICSharpCode.Decompiler.CSharp
}
List<IAstTransform> astTransforms = new List<IAstTransform> {
//new PushNegation(),
new PatternStatementTransform(),
new ReplaceMethodCallsWithOperators(),
new IntroduceUnsafeModifier(),

7
ICSharpCode.Decompiler/IL/ILVariable.cs

@ -101,7 +101,8 @@ namespace ICSharpCode.Decompiler.IL @@ -101,7 +101,8 @@ namespace ICSharpCode.Decompiler.IL
/// Stores are:
/// <list type="item">
/// <item>stloc</item>
/// <item>try.catch.handler (assigning the exception variable)</item>
/// <item>TryCatchHandler (assigning the exception variable)</item>
/// <item>PinnedRegion (assigning the pointer variable)</item>
/// <item>initial values (<see cref="HasInitialValue"/>)</item>
/// </list>
/// </summary>
@ -133,9 +134,9 @@ namespace ICSharpCode.Decompiler.IL @@ -133,9 +134,9 @@ namespace ICSharpCode.Decompiler.IL
public bool HasInitialValue {
get { return hasInitialValue; }
set {
if (Kind == VariableKind.Parameter && !value)
throw new InvalidOperationException("Cannot remove HasInitialValue from parameters");
if (hasInitialValue) {
if (Kind == VariableKind.Parameter)
throw new InvalidOperationException("Cannot remove HasInitialValue from parameters");
StoreCount--;
}
hasInitialValue = value;

2
ICSharpCode.Decompiler/IL/Transforms/CopyPropagation.cs

@ -78,6 +78,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -78,6 +78,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
case OpCode.LdsFlda:
// All address-loading instructions always return the same value for a given operand/argument combination,
// so they can be safely copied.
// ... except for LdElema and LdFlda, because those might throw an exception, and we don't want to
// change the place where the exception is thrown.
return true;
case OpCode.LdLoc:
var v = ((LdLoc)value).Variable;

4
ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

@ -41,13 +41,13 @@ namespace ICSharpCode.Decompiler.Tests @@ -41,13 +41,13 @@ namespace ICSharpCode.Decompiler.Tests
RunWithTest("Mono.Cecil-net45", "Mono.Cecil.dll", "Mono.Cecil.Tests.dll");
}
[Test]
[Test, Ignore("Needs compound assignment")]
public void NewtonsoftJson_net40()
{
RunWithTest("Newtonsoft.Json-net40", "Newtonsoft.Json.dll", "Newtonsoft.Json.Tests.dll");
}
[Test]
[Test, Ignore("Causes assertions in DelegateConstruction")]
public void NRefactory_CSharp()
{
try {

Loading…
Cancel
Save