Browse Source

Add NRefactory to RoundtripAssembly.

Add support for 'ref multiDimArray[1, 2]'.
pull/728/head
Daniel Grunwald 9 years ago
parent
commit
e953379916
  1. 5
      ICSharpCode.Decompiler/IL/ILReader.cs
  2. 12
      ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

5
ICSharpCode.Decompiler/IL/ILReader.cs

@ -998,6 +998,11 @@ namespace ICSharpCode.Decompiler.IL @@ -998,6 +998,11 @@ namespace ICSharpCode.Decompiler.IL
var indices = arguments.Skip(1).ToArray();
return Push(new LdObj(new LdElema(elementType, target, indices), elementType));
}
if (method.Name == "Address") {
var target = arguments[0];
var indices = arguments.Skip(1).ToArray();
return Push(new LdElema(elementType, target, indices));
}
Warn("Unknown method called on array type: " + method.Name);
goto default;
default:

12
ICSharpCode.Decompiler/Tests/RoundtripAssembly.cs

@ -40,6 +40,16 @@ namespace ICSharpCode.Decompiler.Tests @@ -40,6 +40,16 @@ namespace ICSharpCode.Decompiler.Tests
RunWithTest("Mono.Cecil-net45", "Mono.Cecil.dll", "Mono.Cecil.Tests.dll");
}
[Test]
public void NRefactory_CSharp()
{
try {
RunWithTest("NRefactory", "ICSharpCode.NRefactory.CSharp.dll", "ICSharpCode.NRefactory.Tests.dll");
} catch (CompilationFailedException ex) {
Assert.Ignore(ex.Message);
}
}
[Test]
public void Random_Tests_TestCases()
{
@ -88,6 +98,8 @@ namespace ICSharpCode.Decompiler.Tests @@ -88,6 +98,8 @@ namespace ICSharpCode.Decompiler.Tests
resolver.AddSearchDirectory(inputDir);
var module = ModuleDefinition.ReadModule(file, new ReaderParameters { AssemblyResolver = resolver });
var decompiler = new WholeProjectDecompiler();
// use a fixed GUID so that we can diff the output between different ILSpy runs without spurious changes
decompiler.ProjectGuid = Guid.Parse("{127C83E4-4587-4CF9-ADCA-799875F3DFE6}");
decompiler.DecompileProject(module, decompiledDir);
Console.WriteLine($"Decompiled {fileToRoundtrip} in {w.Elapsed.TotalSeconds:f2}");
projectFile = Path.Combine(decompiledDir, module.Assembly.Name.Name + ".csproj");

Loading…
Cancel
Save