Browse Source

ICSharpCode.Decompiler roundtrip test now completes

pull/1586/head
Siegfried Pammer 7 years ago
parent
commit
f3f38783df
  1. 6
      ICSharpCode.Decompiler.Tests/RoundtripAssembly.cs
  2. 4
      ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs
  3. 2
      ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs

6
ICSharpCode.Decompiler.Tests/RoundtripAssembly.cs

@ -69,11 +69,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void ICSharpCode_Decompiler() public void ICSharpCode_Decompiler()
{ {
try { RunWithTest("ICSharpCode.Decompiler", "ICSharpCode.Decompiler.dll", "ICSharpCode.Decompiler.Tests.exe");
RunWithTest("ICSharpCode.Decompiler", "ICSharpCode.Decompiler.dll", "ICSharpCode.Decompiler.Tests.exe");
} catch (TestRunFailedException) {
Assert.Ignore("CorrectnessTestRunner.UndocumentedExpressions fails on recompilation.");
}
} }
[Test] [Test]

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

@ -256,8 +256,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
} }
/// <summary> /// <summary>
/// Newer Roslyn versions use the format "&ltcallerName&gtg__functionName|x_y" /// Newer Roslyn versions use the format "&lt;callerName&gt;g__functionName|x_y"
/// Older versions use "&ltcallerName&gtg__functionNamex_y" /// Older versions use "&lt;callerName&gt;g__functionNamex_y"
/// </summary> /// </summary>
static readonly Regex functionNameRegex = new Regex(@"^<(.*)>g__([^\|]*)\|{0,1}\d+(_\d+)?$", RegexOptions.Compiled); static readonly Regex functionNameRegex = new Regex(@"^<(.*)>g__([^\|]*)\|{0,1}\d+(_\d+)?$", RegexOptions.Compiled);

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

@ -338,7 +338,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (inst.Parent is LdObj || inst.Parent is StObj) if (inst.Parent is LdObj || inst.Parent is StObj)
return; return;
// Get display class info // Get display class info
if (!(inst.Target is LdLoc displayClassLoad && displayClasses.TryGetValue(displayClassLoad.Variable, out var displayClass))) if (!IsDisplayClassLoad(inst.Target, out var displayClassLoad) || !displayClasses.TryGetValue(displayClassLoad, out var displayClass))
return; return;
var field = (IField)inst.Field.MemberDefinition; var field = (IField)inst.Field.MemberDefinition;
if (!displayClass.Variables.TryGetValue(field, out DisplayClassVariable info)) { if (!displayClass.Variables.TryGetValue(field, out DisplayClassVariable info)) {

Loading…
Cancel
Save