Browse Source

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

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

7
ICSharpCode.Decompiler/IL/ILVariable.cs

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

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

@ -78,6 +78,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
case OpCode.LdsFlda: case OpCode.LdsFlda:
// All address-loading instructions always return the same value for a given operand/argument combination, // All address-loading instructions always return the same value for a given operand/argument combination,
// so they can be safely copied. // 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; return true;
case OpCode.LdLoc: case OpCode.LdLoc:
var v = ((LdLoc)value).Variable; var v = ((LdLoc)value).Variable;

4
ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

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

Loading…
Cancel
Save