Browse Source

Add additional tests for .NET 4.0

pull/2642/head
Siegfried Pammer 3 years ago
parent
commit
44dee6ecc2
  1. 45
      ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs
  2. 2
      ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs
  3. 23
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  4. 5
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  5. 85
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  6. 5
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS9_ExtensionGetEnumerator.cs
  7. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/DeconstructionTests.cs
  8. 2
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs
  9. 6
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.cs
  10. 4
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs
  11. 2
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.cs
  12. 15
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UsingVariables.cs
  13. 2
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs
  14. 577
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/AggressiveScalarReplacementOfAggregates.net40.roslyn.il
  15. 509
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/AggressiveScalarReplacementOfAggregates.opt.net40.roslyn.il
  16. 116
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoArrayInitializers.net40.roslyn.il
  17. 103
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoArrayInitializers.opt.net40.roslyn.il
  18. 97
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoDecimalConstants.net40.roslyn.il
  19. 95
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoDecimalConstants.opt.net40.roslyn.il
  20. 117
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoExtensionMethods.net40.roslyn.il
  21. 93
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoExtensionMethods.opt.net40.roslyn.il
  22. 145
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoForEachStatement.net40.roslyn.il
  23. 126
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoForEachStatement.opt.net40.roslyn.il
  24. 179
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoLocalFunctions.net40.roslyn.il
  25. 165
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoLocalFunctions.opt.net40.roslyn.il
  26. 133
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoPropertiesAndEvents.net40.roslyn.il
  27. 131
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoPropertiesAndEvents.opt.net40.roslyn.il
  28. 4
      ICSharpCode.Decompiler.Tests/UglyTestRunner.cs
  29. 16
      ICSharpCode.Decompiler.Tests/VBPrettyTestRunner.cs
  30. 2
      ILSpy.BamlDecompiler.Tests/BamlTestRunner.cs
  31. 10
      ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj
  32. 30
      ILSpy.BamlDecompiler.Tests/Properties/AssemblyInfo.cs
  33. 2
      packages.props

45
ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs

@ -54,6 +54,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -54,6 +54,14 @@ namespace ICSharpCode.Decompiler.Tests
{
CompilerOptions.None,
CompilerOptions.Optimize,
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,
@ -68,6 +76,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -68,6 +76,14 @@ namespace ICSharpCode.Decompiler.Tests
{
CompilerOptions.None,
CompilerOptions.Optimize,
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,
@ -83,7 +99,15 @@ namespace ICSharpCode.Decompiler.Tests @@ -83,7 +99,15 @@ namespace ICSharpCode.Decompiler.Tests
};
static readonly CompilerOptions[] roslynOnlyOptions =
{
{
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,
@ -96,6 +120,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -96,6 +120,12 @@ namespace ICSharpCode.Decompiler.Tests
static readonly CompilerOptions[] roslyn2OrNewerOptions =
{
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0,
CompilerOptions.UseRoslyn3_11_0,
@ -106,6 +136,8 @@ namespace ICSharpCode.Decompiler.Tests @@ -106,6 +136,8 @@ namespace ICSharpCode.Decompiler.Tests
static readonly CompilerOptions[] roslynLatestOnlyOptions =
{
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
@ -361,7 +393,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -361,7 +393,7 @@ namespace ICSharpCode.Decompiler.Tests
async Task RunCS([CallerMemberName] string testName = null, CompilerOptions options = CompilerOptions.UseDebug)
{
if ((options & CompilerOptions.UseRoslynMask) != 0)
if ((options & CompilerOptions.UseRoslynMask) != 0 && (options & CompilerOptions.TargetNet40) == 0)
options |= CompilerOptions.UseTestRunner;
string testFileName = testName + ".cs";
string testOutputFileName = testName + Tester.GetSuffix(options) + ".exe";
@ -379,7 +411,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -379,7 +411,14 @@ namespace ICSharpCode.Decompiler.Tests
// for example when there's unreachable code due to other compiler bugs in the first mcs run.
options &= ~CompilerOptions.UseMcsMask;
options |= CompilerOptions.UseRoslynLatest;
options |= CompilerOptions.UseTestRunner;
// Also, add an .exe.config so that we consistently use the .NET 4.x runtime.
File.WriteAllText(outputFile.PathToAssembly + ".config", @"<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
<startup>
<supportedRuntime version=""v4.0"" sku="".NETFramework,Version=v4.0,Profile=Client"" />
</startup>
</configuration>");
options |= CompilerOptions.TargetNet40;
}
decompiledOutputFile = await Tester.CompileCSharp(decompiledCodeFile, options).ConfigureAwait(false);

2
ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -60,7 +60,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var vbcPath = roslynToolset.GetVBCompiler(roslynVersion);
IEnumerable<string> references;
if ((flags & CompilerOptions.UseRoslynMask) != 0)
if ((flags & CompilerOptions.UseRoslynMask) != 0 && (flags & CompilerOptions.TargetNet40) == 0)
{
references = coreDefaultReferences.Select(r => "-r:\"" + r + "\"");
}

23
ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

@ -18,7 +18,6 @@ @@ -18,7 +18,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection.PortableExecutable;
@ -59,7 +58,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -59,7 +58,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
UseRoslyn1_3_2 = 0x10,
UseMcs2_6_4 = 0x20,
ReferenceVisualBasic = 0x40,
//ReferenceCore = 0x80,
TargetNet40 = 0x80,
GeneratePdb = 0x100,
Preview = 0x200,
UseRoslyn2_10_0 = 0x400,
@ -212,10 +211,12 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -212,10 +211,12 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
return outputFile;
}
string ildasmPath = SdkUtility.GetSdkPath("ildasm.exe");
string ildasmPath = Path.Combine(
Path.GetDirectoryName(typeof(Tester).Assembly.Location),
"ildasm.exe");
var command = Cli.Wrap(ildasmPath)
.WithArguments($"/nobar /utf8 /out=\"{outputFile}\" \"{sourceFileName}\"")
.WithArguments($"/utf8 /out=\"{outputFile}\" \"{sourceFileName}\"")
.WithValidation(CommandResultValidation.None);
var result = await command.ExecuteBufferedAsync().ConfigureAwait(false);
@ -310,6 +311,10 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -310,6 +311,10 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
{
preprocessorSymbols.Add("OPT");
}
if (flags.HasFlag(CompilerOptions.TargetNet40))
{
preprocessorSymbols.Add("NET40");
}
if ((flags & CompilerOptions.UseRoslynMask) != 0)
{
preprocessorSymbols.Add("NETCORE");
@ -373,7 +378,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -373,7 +378,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
{
sourceFileNames.Add(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(sourceFileName), match.Groups[1].Value)));
}
if ((flags & CompilerOptions.UseRoslynMask) != 0)
bool targetNet40 = (flags & CompilerOptions.TargetNet40) != 0;
bool useRoslyn = (flags & CompilerOptions.UseRoslynMask) != 0;
if (useRoslyn && !targetNet40)
{
sourceFileNames.Add(targetFrameworkAttributeSnippetFile.Value);
}
@ -397,7 +404,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -397,7 +404,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
string libPath;
IEnumerable<string> references;
if ((flags & CompilerOptions.UseRoslynMask) != 0)
if (useRoslyn && !targetNet40)
{
libPath = "\"" + coreRefAsmPath + "\"";
references = coreDefaultReferences.Select(r => "-r:\"" + Path.Combine(coreRefAsmPath, r) + "\"");
@ -420,7 +427,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -420,7 +427,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
if (roslynVersion != "legacy")
{
otherOptions += "/shared ";
if (Version.Parse(roslynVersion).Major > 2)
if (!targetNet40 && Version.Parse(roslynVersion).Major > 2)
{
if (flags.HasFlag(CompilerOptions.NullableEnable))
otherOptions += "/nullable+ ";
@ -611,6 +618,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -611,6 +618,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
suffix += ".32";
if ((cscOptions & CompilerOptions.UseDebug) != 0)
suffix += ".dbg";
if ((cscOptions & CompilerOptions.TargetNet40) != 0)
suffix += ".net40";
if ((cscOptions & CompilerOptions.UseRoslyn1_3_2) != 0)
suffix += ".roslyn1";
if ((cscOptions & CompilerOptions.UseRoslyn2_10_0) != 0)

5
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -11,7 +11,9 @@ @@ -11,7 +11,9 @@
<NoWarn>1701;1702;1705,67,169,1058,728,1720,649,168,251,660,661,675</NoWarn>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<GenerateAssemblyVersionAttribute>False</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>False</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>False</GenerateAssemblyInformationalVersionAttribute>
<EnableDefaultItems>false</EnableDefaultItems>
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
@ -56,6 +58,7 @@ @@ -56,6 +58,7 @@
<PackageReference Include="System.Memory" Version="4.5.4" />
<PackageReference Include="Mono.Cecil" Version="$(MonoCecilVersion)" />
<PackageReference Include="Microsoft.NETCore.ILAsm" Version="$(ILAsmVersion)" />
<PackageReference Include="Microsoft.NETCore.ILDAsm" Version="$(ILDAsmVersion)" />
</ItemGroup>
<ItemGroup>

85
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.CodeDom.Compiler;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
@ -58,6 +57,26 @@ namespace ICSharpCode.Decompiler.Tests @@ -58,6 +57,26 @@ namespace ICSharpCode.Decompiler.Tests
CompilerOptions.Optimize
};
static readonly CompilerOptions[] roslynOnlyWithNet40Options =
{
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0,
CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslynOnlyOptions =
{
CompilerOptions.UseRoslyn1_3_2,
@ -70,6 +89,22 @@ namespace ICSharpCode.Decompiler.Tests @@ -70,6 +89,22 @@ namespace ICSharpCode.Decompiler.Tests
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslyn2OrNewerWithNet40Options =
{
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0,
CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslyn2OrNewerOptions =
{
CompilerOptions.UseRoslyn2_10_0,
@ -80,6 +115,18 @@ namespace ICSharpCode.Decompiler.Tests @@ -80,6 +115,18 @@ namespace ICSharpCode.Decompiler.Tests
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslyn3OrNewerWithNet40Options =
{
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslyn3OrNewerOptions =
{
CompilerOptions.UseRoslyn3_11_0,
@ -88,6 +135,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -88,6 +135,14 @@ namespace ICSharpCode.Decompiler.Tests
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslynLatestOnlyWithNet40Options =
{
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslynLatestOnlyOptions =
{
CompilerOptions.UseRoslynLatest,
@ -98,6 +153,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -98,6 +153,14 @@ namespace ICSharpCode.Decompiler.Tests
{
CompilerOptions.None,
CompilerOptions.Optimize,
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,
@ -112,6 +175,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -112,6 +175,14 @@ namespace ICSharpCode.Decompiler.Tests
{
CompilerOptions.None,
CompilerOptions.Optimize,
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,
@ -238,7 +309,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -238,7 +309,7 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
public async Task UsingVariables([ValueSource(nameof(roslyn3OrNewerOptions))] CompilerOptions cscOptions)
public async Task UsingVariables([ValueSource(nameof(roslyn3OrNewerWithNet40Options))] CompilerOptions cscOptions)
{
await RunForLibrary(cscOptions: cscOptions);
}
@ -459,9 +530,9 @@ namespace ICSharpCode.Decompiler.Tests @@ -459,9 +530,9 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
public async Task StringInterpolation([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
public async Task StringInterpolation([ValueSource(nameof(roslynOnlyWithNet40Options))] CompilerOptions cscOptions)
{
if (cscOptions.HasFlag(CompilerOptions.UseRoslynLatest))
if (!cscOptions.HasFlag(CompilerOptions.TargetNet40) && cscOptions.HasFlag(CompilerOptions.UseRoslynLatest))
{
Assert.Ignore("DefaultInterpolatedStringHandler is not yet supported!");
return;
@ -621,15 +692,15 @@ namespace ICSharpCode.Decompiler.Tests @@ -621,15 +692,15 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
public async Task CS9_ExtensionGetEnumerator([ValueSource(nameof(roslyn3OrNewerOptions))] CompilerOptions cscOptions)
public async Task CS9_ExtensionGetEnumerator([ValueSource(nameof(roslyn3OrNewerWithNet40Options))] CompilerOptions cscOptions)
{
await RunForLibrary(cscOptions: cscOptions | CompilerOptions.Preview);
await RunForLibrary(cscOptions: cscOptions);
}
[Test]
public async Task CovariantReturns([ValueSource(nameof(roslyn3OrNewerOptions))] CompilerOptions cscOptions)
{
await RunForLibrary(cscOptions: cscOptions | CompilerOptions.Preview);
await RunForLibrary(cscOptions: cscOptions);
}
[Test]

5
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS9_ExtensionGetEnumerator.cs

@ -29,7 +29,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -29,7 +29,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Console.WriteLine(item);
}
}
#if !NET40
public async void TestAsync(Generic<int> c)
{
await foreach (int item in c)
@ -37,6 +37,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -37,6 +37,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Console.WriteLine(item);
}
}
#endif
}
public static class CS9_ExtensionGetEnumerator_Ext
@ -49,9 +50,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -49,9 +50,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
throw null;
}
#if !NET40
public static IAsyncEnumerator<T> GetAsyncEnumerator<T>(this CS9_ExtensionGetEnumerator.Generic<T> c)
{
throw null;
}
#endif
}
}

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/DeconstructionTests.cs

@ -22,6 +22,15 @@ using System.Runtime.InteropServices; @@ -22,6 +22,15 @@ using System.Runtime.InteropServices;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public static class DeconstructionExt
{
public static void Deconstruct<K, V>(this KeyValuePair<K, V> pair, out K key, out V value)
{
key = pair.Key;
value = pair.Value;
}
}
internal class DeconstructionTests
{
[StructLayout(LayoutKind.Sequential, Size = 1)]

2
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs

@ -376,7 +376,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests @@ -376,7 +376,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
{ 1, 1, 1 }
};
#if CS73
#if CS73 && !NET40
public static ReadOnlySpan<byte> StaticData1 => new byte[1] { 0 };
public static ReadOnlySpan<byte> StaticData3 => new byte[3] { 1, 2, 3 };

6
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.cs

@ -24,7 +24,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -24,7 +24,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public interface IA
{
#if CS80
#if CS80 && !NET40
static int Field;
#endif
int Property1 { get; }
@ -34,7 +34,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -34,7 +34,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
event EventHandler MyEvent;
void Method();
#if CS80
#if CS80 && !NET40
static IA()
{
@ -69,7 +69,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -69,7 +69,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
public interface IA2 : IA
{
#if CS80
#if CS80 && !NET40
int IA.Property3 {
get {
return 0;

4
ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs

@ -20,7 +20,9 @@ using System; @@ -20,7 +20,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
#if ROSLYN4
#if ROSLYN4 && !NET40
// This is needed because there are some nullability attributes on compiler-generated lambdas,
// which are removed after IntroduceUsingDeclarations ran.
using System.Runtime.CompilerServices;
#endif

2
ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.cs

@ -411,7 +411,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -411,7 +411,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
#if CS73
#if CS73 && !NET40
public unsafe void FixedSpan(Span<int> span)
{
fixed (int* ptr = span)

15
ICSharpCode.Decompiler.Tests/TestCases/Pretty/UsingVariables.cs

@ -17,7 +17,9 @@ @@ -17,7 +17,9 @@
// DEALINGS IN THE SOFTWARE.
using System;
#if !NET40
using System.Threading.Tasks;
#endif
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
@ -28,20 +30,22 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -28,20 +30,22 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
return null;
}
public IAsyncDisposable GetAsyncDisposable()
private void Use(IDisposable disposable)
{
return null;
}
private void Use(IDisposable disposable)
#if !NET40
public IAsyncDisposable GetAsyncDisposable()
{
return null;
}
private void Use(IAsyncDisposable asyncDisposable)
{
}
#endif
public void SimpleUsingVar()
{
@ -83,7 +87,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -83,7 +87,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Use(disposable);
Use(disposable2);
}
#if !NET40
public async Task SimpleUsingVarAsync()
{
Console.WriteLine("before using");
@ -91,5 +95,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -91,5 +95,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Console.WriteLine("inside using");
Use(asyncDisposable);
}
#endif
}
}

2
ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs

@ -83,7 +83,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -83,7 +83,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public const float Float_Tenth = 0.1f;
public const double Double_Tenth = 0.1;
#if ROSLYN
#if ROSLYN && !NET40
public const float Float_PI = MathF.PI;
public const float Float_HalfOfPI = MathF.PI / 2f;
public const float Float_QuarterOfPI = MathF.PI / 4f;

577
ICSharpCode.Decompiler.Tests/TestCases/Ugly/AggressiveScalarReplacementOfAggregates.net40.roslyn.il

@ -0,0 +1,577 @@ @@ -0,0 +1,577 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmp4B37
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmp4B37.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass
extends [mscorlib]System.Object
{
.field public class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program thisField
.field public int32 field1
.field public string field2
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method DisplayClass::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass
extends [mscorlib]System.Object
{
.field public class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass field3
.field public int32 field1
.field public string field2
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method NestedDisplayClass::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program
extends [mscorlib]System.Object
{
.method public hidebysig instance int32
Rand() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0006: throw
} // end of method Program::Rand
.method public hidebysig instance void
Test1() cil managed
{
// Code size 55 (0x37)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldc.i4.s 42
IL_0009: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000e: dup
IL_000f: ldstr "Hello World!"
IL_0014: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0019: stloc.0
IL_001a: ldstr "{0} {1}"
IL_001f: ldloc.0
IL_0020: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0025: box [mscorlib]System.Int32
IL_002a: ldloc.0
IL_002b: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0030: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0035: nop
IL_0036: ret
} // end of method Program::Test1
.method public hidebysig instance void
Test2() cil managed
{
// Code size 60 (0x3c)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldc.i4.s 42
IL_0009: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000e: dup
IL_000f: ldstr "Hello World!"
IL_0014: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0019: stloc.0
IL_001a: ldstr "{0} {1}"
IL_001f: ldloc.0
IL_0020: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0025: box [mscorlib]System.Int32
IL_002a: ldloc.0
IL_002b: callvirt instance int32 [mscorlib]System.Object::GetHashCode()
IL_0030: box [mscorlib]System.Int32
IL_0035: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_003a: nop
IL_003b: ret
} // end of method Program::Test2
.method public hidebysig instance void
Test3() cil managed
{
// Code size 50 (0x32)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldc.i4.s 42
IL_0009: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000e: dup
IL_000f: ldstr "Hello World!"
IL_0014: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0019: stloc.0
IL_001a: ldstr "{0} {1}"
IL_001f: ldloc.0
IL_0020: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0025: box [mscorlib]System.Int32
IL_002a: ldloc.0
IL_002b: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0030: nop
IL_0031: ret
} // end of method Program::Test3
.method public hidebysig instance void
Test4() cil managed
{
// Code size 114 (0x72)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass V_1,
bool V_2)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldarg.0
IL_0008: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::thisField
IL_000d: dup
IL_000e: ldc.i4.s 42
IL_0010: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0015: dup
IL_0016: ldstr "Hello World!"
IL_001b: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0020: stloc.0
IL_0021: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::.ctor()
IL_0026: dup
IL_0027: ldc.i4 0x1267
IL_002c: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0031: dup
IL_0032: ldstr "ILSpy"
IL_0037: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_003c: stloc.1
IL_003d: ldloc.0
IL_003e: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0043: ldc.i4.s 100
IL_0045: cgt
IL_0047: stloc.2
IL_0048: ldloc.2
IL_0049: brfalse.s IL_0056
IL_004b: nop
IL_004c: ldloc.1
IL_004d: ldloc.0
IL_004e: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0053: nop
IL_0054: br.s IL_005f
IL_0056: nop
IL_0057: ldloc.1
IL_0058: ldnull
IL_0059: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_005e: nop
IL_005f: ldstr "{0} {1}"
IL_0064: ldloc.0
IL_0065: ldloc.1
IL_0066: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_006b: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0070: nop
IL_0071: ret
} // end of method Program::Test4
.method public hidebysig instance void
Test5() cil managed
{
// Code size 135 (0x87)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass V_1,
bool V_2)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldarg.0
IL_0008: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::thisField
IL_000d: dup
IL_000e: ldc.i4.s 42
IL_0010: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0015: dup
IL_0016: ldstr "Hello World!"
IL_001b: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0020: stloc.0
IL_0021: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::.ctor()
IL_0026: dup
IL_0027: ldc.i4 0x1267
IL_002c: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0031: dup
IL_0032: ldstr "ILSpy"
IL_0037: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_003c: stloc.1
IL_003d: ldloc.0
IL_003e: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0043: ldc.i4.s 100
IL_0045: cgt
IL_0047: stloc.2
IL_0048: ldloc.2
IL_0049: brfalse.s IL_0056
IL_004b: nop
IL_004c: ldloc.1
IL_004d: ldloc.0
IL_004e: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0053: nop
IL_0054: br.s IL_005f
IL_0056: nop
IL_0057: ldloc.1
IL_0058: ldnull
IL_0059: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_005e: nop
IL_005f: ldstr "{0} {1}"
IL_0064: ldloc.1
IL_0065: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_006a: ldloc.1
IL_006b: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0070: call instance string [mscorlib]System.Int32::ToString()
IL_0075: call string [mscorlib]System.String::Concat(string,
string)
IL_007a: ldloc.1
IL_007b: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0080: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0085: nop
IL_0086: ret
} // end of method Program::Test5
.method public hidebysig instance void
Issue1898(int32 i) cil managed
{
// Code size 151 (0x97)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass V_1,
int32 V_2,
int32 V_3,
int32 V_4,
bool V_5)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldarg.0
IL_0008: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::thisField
IL_000d: dup
IL_000e: ldarg.1
IL_000f: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0014: stloc.0
IL_0015: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::.ctor()
IL_001a: stloc.1
IL_001b: br.s IL_0092
IL_001d: nop
IL_001e: ldarg.0
IL_001f: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program::Rand()
IL_0024: stloc.3
IL_0025: ldloc.3
IL_0026: stloc.2
IL_0027: ldloc.2
IL_0028: ldc.i4.1
IL_0029: sub
IL_002a: switch (
IL_003d,
IL_004b,
IL_0062)
IL_003b: br.s IL_006b
IL_003d: ldloc.1
IL_003e: ldarg.0
IL_003f: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program::Rand()
IL_0044: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0049: br.s IL_0091
IL_004b: ldloc.1
IL_004c: ldarg.0
IL_004d: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program::Rand()
IL_0052: stloc.s V_4
IL_0054: ldloca.s V_4
IL_0056: call instance string [mscorlib]System.Int32::ToString()
IL_005b: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_0060: br.s IL_0091
IL_0062: ldloc.1
IL_0063: ldloc.0
IL_0064: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0069: br.s IL_0091
IL_006b: ldloc.1
IL_006c: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0071: call void [mscorlib]System.Console::WriteLine(int32)
IL_0076: nop
IL_0077: ldloc.1
IL_0078: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_007d: call void [mscorlib]System.Console::WriteLine(string)
IL_0082: nop
IL_0083: ldloc.1
IL_0084: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0089: call void [mscorlib]System.Console::WriteLine(object)
IL_008e: nop
IL_008f: br.s IL_0091
IL_0091: nop
IL_0092: ldc.i4.1
IL_0093: stloc.s V_5
IL_0095: br.s IL_001d
} // end of method Program::Issue1898
.method public hidebysig instance void
Test6(int32 i) cil managed
{
// Code size 68 (0x44)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
bool V_1)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldarg.1
IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000d: dup
IL_000e: ldstr "Hello World!"
IL_0013: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0018: stloc.0
IL_0019: ldarg.1
IL_001a: ldc.i4.0
IL_001b: clt
IL_001d: stloc.1
IL_001e: ldloc.1
IL_001f: brfalse.s IL_0027
IL_0021: nop
IL_0022: ldarg.1
IL_0023: neg
IL_0024: starg.s i
IL_0026: nop
IL_0027: ldstr "{0} {1}"
IL_002c: ldloc.0
IL_002d: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0032: box [mscorlib]System.Int32
IL_0037: ldloc.0
IL_0038: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_003d: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0042: nop
IL_0043: ret
} // end of method Program::Test6
.method public hidebysig instance void
Test6b(int32 i) cil managed
{
// Code size 69 (0x45)
.maxstack 3
.locals init (int32 V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_1,
bool V_2)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: stloc.0
IL_0003: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0008: dup
IL_0009: ldloc.0
IL_000a: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000f: dup
IL_0010: ldstr "Hello World!"
IL_0015: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_001a: stloc.1
IL_001b: ldloc.0
IL_001c: ldc.i4.0
IL_001d: clt
IL_001f: stloc.2
IL_0020: ldloc.2
IL_0021: brfalse.s IL_0028
IL_0023: nop
IL_0024: ldloc.0
IL_0025: neg
IL_0026: stloc.0
IL_0027: nop
IL_0028: ldstr "{0} {1}"
IL_002d: ldloc.1
IL_002e: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0033: box [mscorlib]System.Int32
IL_0038: ldloc.1
IL_0039: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_003e: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0043: nop
IL_0044: ret
} // end of method Program::Test6b
.method public hidebysig instance void
Test7(int32 i) cil managed
{
// Code size 71 (0x47)
.maxstack 4
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
int32 V_1)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldarg.1
IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000d: dup
IL_000e: ldstr "Hello World!"
IL_0013: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0018: stloc.0
IL_0019: ldstr "{0} {1} {2}"
IL_001e: ldloc.0
IL_001f: dup
IL_0020: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0025: stloc.1
IL_0026: ldloc.1
IL_0027: ldc.i4.1
IL_0028: add
IL_0029: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_002e: ldloc.1
IL_002f: box [mscorlib]System.Int32
IL_0034: ldloc.0
IL_0035: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_003a: ldarg.1
IL_003b: box [mscorlib]System.Int32
IL_0040: call void [mscorlib]System.Console::WriteLine(string,
object,
object,
object)
IL_0045: nop
IL_0046: ret
} // end of method Program::Test7
.method public hidebysig instance void
Test8(int32 i) cil managed
{
// Code size 58 (0x3a)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: nop
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0006: dup
IL_0007: ldarg.1
IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000d: dup
IL_000e: ldstr "Hello World!"
IL_0013: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0018: stloc.0
IL_0019: ldc.i4.s 42
IL_001b: starg.s i
IL_001d: ldstr "{0} {1}"
IL_0022: ldloc.0
IL_0023: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0028: box [mscorlib]System.Int32
IL_002d: ldloc.0
IL_002e: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0033: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0038: nop
IL_0039: ret
} // end of method Program::Test8
.method public hidebysig instance void
Test8b(int32 i) cil managed
{
// Code size 59 (0x3b)
.maxstack 3
.locals init (int32 V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: stloc.0
IL_0003: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0008: dup
IL_0009: ldloc.0
IL_000a: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000f: dup
IL_0010: ldstr "Hello World!"
IL_0015: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_001a: stloc.1
IL_001b: ldc.i4.s 42
IL_001d: stloc.0
IL_001e: ldstr "{0} {1}"
IL_0023: ldloc.1
IL_0024: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0029: box [mscorlib]System.Int32
IL_002e: ldloc.1
IL_002f: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0034: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0039: nop
IL_003a: ret
} // end of method Program::Test8b
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method Program::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

509
ICSharpCode.Decompiler.Tests/TestCases/Ugly/AggressiveScalarReplacementOfAggregates.opt.net40.roslyn.il

@ -0,0 +1,509 @@ @@ -0,0 +1,509 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmp96F5
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmp96F5.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass
extends [mscorlib]System.Object
{
.field public class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program thisField
.field public int32 field1
.field public string field2
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method DisplayClass::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass
extends [mscorlib]System.Object
{
.field public class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass field3
.field public int32 field1
.field public string field2
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method NestedDisplayClass::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program
extends [mscorlib]System.Object
{
.method public hidebysig instance int32
Rand() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0005: throw
} // end of method Program::Rand
.method public hidebysig instance void
Test1() cil managed
{
// Code size 53 (0x35)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldc.i4.s 42
IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000d: dup
IL_000e: ldstr "Hello World!"
IL_0013: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0018: stloc.0
IL_0019: ldstr "{0} {1}"
IL_001e: ldloc.0
IL_001f: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0024: box [mscorlib]System.Int32
IL_0029: ldloc.0
IL_002a: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_002f: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0034: ret
} // end of method Program::Test1
.method public hidebysig instance void
Test2() cil managed
{
// Code size 58 (0x3a)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldc.i4.s 42
IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000d: dup
IL_000e: ldstr "Hello World!"
IL_0013: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0018: stloc.0
IL_0019: ldstr "{0} {1}"
IL_001e: ldloc.0
IL_001f: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0024: box [mscorlib]System.Int32
IL_0029: ldloc.0
IL_002a: callvirt instance int32 [mscorlib]System.Object::GetHashCode()
IL_002f: box [mscorlib]System.Int32
IL_0034: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0039: ret
} // end of method Program::Test2
.method public hidebysig instance void
Test3() cil managed
{
// Code size 48 (0x30)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldc.i4.s 42
IL_0008: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000d: dup
IL_000e: ldstr "Hello World!"
IL_0013: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0018: stloc.0
IL_0019: ldstr "{0} {1}"
IL_001e: ldloc.0
IL_001f: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0024: box [mscorlib]System.Int32
IL_0029: ldloc.0
IL_002a: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_002f: ret
} // end of method Program::Test3
.method public hidebysig instance void
Test4() cil managed
{
// Code size 104 (0x68)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass V_1)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldarg.0
IL_0007: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::thisField
IL_000c: dup
IL_000d: ldc.i4.s 42
IL_000f: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0014: dup
IL_0015: ldstr "Hello World!"
IL_001a: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_001f: stloc.0
IL_0020: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::.ctor()
IL_0025: dup
IL_0026: ldc.i4 0x1267
IL_002b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0030: dup
IL_0031: ldstr "ILSpy"
IL_0036: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_003b: stloc.1
IL_003c: ldloc.0
IL_003d: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0042: ldc.i4.s 100
IL_0044: ble.s IL_004f
IL_0046: ldloc.1
IL_0047: ldloc.0
IL_0048: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_004d: br.s IL_0056
IL_004f: ldloc.1
IL_0050: ldnull
IL_0051: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0056: ldstr "{0} {1}"
IL_005b: ldloc.0
IL_005c: ldloc.1
IL_005d: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0062: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0067: ret
} // end of method Program::Test4
.method public hidebysig instance void
Test5() cil managed
{
// Code size 125 (0x7d)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass V_1)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldarg.0
IL_0007: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::thisField
IL_000c: dup
IL_000d: ldc.i4.s 42
IL_000f: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0014: dup
IL_0015: ldstr "Hello World!"
IL_001a: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_001f: stloc.0
IL_0020: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::.ctor()
IL_0025: dup
IL_0026: ldc.i4 0x1267
IL_002b: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0030: dup
IL_0031: ldstr "ILSpy"
IL_0036: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_003b: stloc.1
IL_003c: ldloc.0
IL_003d: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0042: ldc.i4.s 100
IL_0044: ble.s IL_004f
IL_0046: ldloc.1
IL_0047: ldloc.0
IL_0048: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_004d: br.s IL_0056
IL_004f: ldloc.1
IL_0050: ldnull
IL_0051: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0056: ldstr "{0} {1}"
IL_005b: ldloc.1
IL_005c: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_0061: ldloc.1
IL_0062: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0067: call instance string [mscorlib]System.Int32::ToString()
IL_006c: call string [mscorlib]System.String::Concat(string,
string)
IL_0071: ldloc.1
IL_0072: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0077: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_007c: ret
} // end of method Program::Test5
.method public hidebysig instance void
Issue1898(int32 i) cil managed
{
// Code size 135 (0x87)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass V_1,
int32 V_2,
int32 V_3)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldarg.0
IL_0007: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::thisField
IL_000c: dup
IL_000d: ldarg.1
IL_000e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0013: stloc.0
IL_0014: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::.ctor()
IL_0019: stloc.1
IL_001a: ldarg.0
IL_001b: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program::Rand()
IL_0020: stloc.2
IL_0021: ldloc.2
IL_0022: ldc.i4.1
IL_0023: sub
IL_0024: switch (
IL_0037,
IL_0045,
IL_005b)
IL_0035: br.s IL_0064
IL_0037: ldloc.1
IL_0038: ldarg.0
IL_0039: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program::Rand()
IL_003e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_0043: br.s IL_001a
IL_0045: ldloc.1
IL_0046: ldarg.0
IL_0047: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program::Rand()
IL_004c: stloc.3
IL_004d: ldloca.s V_3
IL_004f: call instance string [mscorlib]System.Int32::ToString()
IL_0054: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_0059: br.s IL_001a
IL_005b: ldloc.1
IL_005c: ldloc.0
IL_005d: stfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0062: br.s IL_001a
IL_0064: ldloc.1
IL_0065: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field1
IL_006a: call void [mscorlib]System.Console::WriteLine(int32)
IL_006f: ldloc.1
IL_0070: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field2
IL_0075: call void [mscorlib]System.Console::WriteLine(string)
IL_007a: ldloc.1
IL_007b: ldfld class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass ICSharpCode.Decompiler.Tests.TestCases.Ugly.NestedDisplayClass::field3
IL_0080: call void [mscorlib]System.Console::WriteLine(object)
IL_0085: br.s IL_001a
} // end of method Program::Issue1898
.method public hidebysig instance void
Test6(int32 i) cil managed
{
// Code size 60 (0x3c)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldarg.1
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000c: dup
IL_000d: ldstr "Hello World!"
IL_0012: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0017: stloc.0
IL_0018: ldarg.1
IL_0019: ldc.i4.0
IL_001a: bge.s IL_0020
IL_001c: ldarg.1
IL_001d: neg
IL_001e: starg.s i
IL_0020: ldstr "{0} {1}"
IL_0025: ldloc.0
IL_0026: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_002b: box [mscorlib]System.Int32
IL_0030: ldloc.0
IL_0031: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0036: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_003b: ret
} // end of method Program::Test6
.method public hidebysig instance void
Test6b(int32 i) cil managed
{
// Code size 61 (0x3d)
.maxstack 3
.locals init (int32 V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_1)
IL_0000: ldarg.1
IL_0001: stloc.0
IL_0002: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0007: dup
IL_0008: ldloc.0
IL_0009: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000e: dup
IL_000f: ldstr "Hello World!"
IL_0014: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0019: stloc.1
IL_001a: ldloc.0
IL_001b: ldc.i4.0
IL_001c: bge.s IL_0021
IL_001e: ldloc.0
IL_001f: neg
IL_0020: stloc.0
IL_0021: ldstr "{0} {1}"
IL_0026: ldloc.1
IL_0027: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_002c: box [mscorlib]System.Int32
IL_0031: ldloc.1
IL_0032: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0037: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_003c: ret
} // end of method Program::Test6b
.method public hidebysig instance void
Test7(int32 i) cil managed
{
// Code size 69 (0x45)
.maxstack 4
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0,
int32 V_1)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldarg.1
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000c: dup
IL_000d: ldstr "Hello World!"
IL_0012: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0017: stloc.0
IL_0018: ldstr "{0} {1} {2}"
IL_001d: ldloc.0
IL_001e: dup
IL_001f: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0024: stloc.1
IL_0025: ldloc.1
IL_0026: ldc.i4.1
IL_0027: add
IL_0028: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_002d: ldloc.1
IL_002e: box [mscorlib]System.Int32
IL_0033: ldloc.0
IL_0034: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0039: ldarg.1
IL_003a: box [mscorlib]System.Int32
IL_003f: call void [mscorlib]System.Console::WriteLine(string,
object,
object,
object)
IL_0044: ret
} // end of method Program::Test7
.method public hidebysig instance void
Test8(int32 i) cil managed
{
// Code size 56 (0x38)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_0)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0005: dup
IL_0006: ldarg.1
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000c: dup
IL_000d: ldstr "Hello World!"
IL_0012: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0017: stloc.0
IL_0018: ldc.i4.s 42
IL_001a: starg.s i
IL_001c: ldstr "{0} {1}"
IL_0021: ldloc.0
IL_0022: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0027: box [mscorlib]System.Int32
IL_002c: ldloc.0
IL_002d: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0032: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0037: ret
} // end of method Program::Test8
.method public hidebysig instance void
Test8b(int32 i) cil managed
{
// Code size 57 (0x39)
.maxstack 3
.locals init (int32 V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass V_1)
IL_0000: ldarg.1
IL_0001: stloc.0
IL_0002: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::.ctor()
IL_0007: dup
IL_0008: ldloc.0
IL_0009: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_000e: dup
IL_000f: ldstr "Hello World!"
IL_0014: stfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0019: stloc.1
IL_001a: ldc.i4.s 42
IL_001c: stloc.0
IL_001d: ldstr "{0} {1}"
IL_0022: ldloc.1
IL_0023: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field1
IL_0028: box [mscorlib]System.Int32
IL_002d: ldloc.1
IL_002e: ldfld string ICSharpCode.Decompiler.Tests.TestCases.Ugly.DisplayClass::field2
IL_0033: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0038: ret
} // end of method Program::Test8b
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method Program::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Program
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

116
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoArrayInitializers.net40.roslyn.il

@ -0,0 +1,116 @@ @@ -0,0 +1,116 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmp9704
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmp9704.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoArrayInitializers
extends [mscorlib]System.Object
{
.method public hidebysig instance int32[]
LiteralArray() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.3
IL_0002: newarr [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'4636993D3E1DA4E9D6B8F87B79E8F7C6D018580D52661950EABC3845C5897A4D'
IL_000d: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0012: stloc.0
IL_0013: br.s IL_0015
IL_0015: ldloc.0
IL_0016: ret
} // end of method NoArrayInitializers::LiteralArray
.method public hidebysig instance int32[]
VariableArray(int32 a,
int32 b) cil managed
{
// Code size 20 (0x14)
.maxstack 4
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.2
IL_0002: newarr [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldarg.1
IL_000a: stelem.i4
IL_000b: dup
IL_000c: ldc.i4.1
IL_000d: ldarg.2
IL_000e: stelem.i4
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method NoArrayInitializers::VariableArray
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method NoArrayInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoArrayInitializers
.class private auto ansi sealed '<PrivateImplementationDetails>'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.class explicit ansi sealed nested private '__StaticArrayInitTypeSize=12'
extends [mscorlib]System.ValueType
{
.pack 1
.size 12
} // end of class '__StaticArrayInitTypeSize=12'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '4636993D3E1DA4E9D6B8F87B79E8F7C6D018580D52661950EABC3845C5897A4D' at I_000026C0
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_000026C0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00)
// *********** DISASSEMBLY COMPLETE ***********************

103
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoArrayInitializers.opt.net40.roslyn.il

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmp9705
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmp9705.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoArrayInitializers
extends [mscorlib]System.Object
{
.method public hidebysig instance int32[]
LiteralArray() cil managed
{
// Code size 18 (0x12)
.maxstack 8
IL_0000: ldc.i4.3
IL_0001: newarr [mscorlib]System.Int32
IL_0006: dup
IL_0007: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'4636993D3E1DA4E9D6B8F87B79E8F7C6D018580D52661950EABC3845C5897A4D'
IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0011: ret
} // end of method NoArrayInitializers::LiteralArray
.method public hidebysig instance int32[]
VariableArray(int32 a,
int32 b) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldc.i4.2
IL_0001: newarr [mscorlib]System.Int32
IL_0006: dup
IL_0007: ldc.i4.0
IL_0008: ldarg.1
IL_0009: stelem.i4
IL_000a: dup
IL_000b: ldc.i4.1
IL_000c: ldarg.2
IL_000d: stelem.i4
IL_000e: ret
} // end of method NoArrayInitializers::VariableArray
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method NoArrayInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoArrayInitializers
.class private auto ansi sealed '<PrivateImplementationDetails>'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.class explicit ansi sealed nested private '__StaticArrayInitTypeSize=12'
extends [mscorlib]System.ValueType
{
.pack 1
.size 12
} // end of class '__StaticArrayInitTypeSize=12'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '4636993D3E1DA4E9D6B8F87B79E8F7C6D018580D52661950EABC3845C5897A4D' at I_00002690
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_00002690 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00)
// *********** DISASSEMBLY COMPLETE ***********************

97
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoDecimalConstants.net40.roslyn.il

@ -0,0 +1,97 @@ @@ -0,0 +1,97 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpA278
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpA278.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoDecimalConstants
extends [mscorlib]System.Object
{
.field private static initonly valuetype [mscorlib]System.Decimal constant
.custom instance void [mscorlib]System.Runtime.CompilerServices.DecimalConstantAttribute::.ctor(uint8,
uint8,
uint32,
uint32,
uint32) = ( 01 00 01 00 00 00 00 00 00 00 00 00 0A 00 00 00
00 00 )
.method private hidebysig instance void
MethodWithOptionalParameter([opt] valuetype [mscorlib]System.Decimal parameter) cil managed
{
.param [1]
.custom instance void [mscorlib]System.Runtime.CompilerServices.DecimalConstantAttribute::.ctor(uint8,
uint8,
uint32,
uint32,
uint32) = ( 01 00 01 00 00 00 00 00 00 00 00 00 0A 00 00 00
00 00 )
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method NoDecimalConstants::MethodWithOptionalParameter
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method NoDecimalConstants::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldc.i4.s 10
IL_0002: ldc.i4.0
IL_0003: ldc.i4.0
IL_0004: ldc.i4.0
IL_0005: ldc.i4.1
IL_0006: newobj instance void [mscorlib]System.Decimal::.ctor(int32,
int32,
int32,
bool,
uint8)
IL_000b: stsfld valuetype [mscorlib]System.Decimal ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoDecimalConstants::constant
IL_0010: ret
} // end of method NoDecimalConstants::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoDecimalConstants
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

95
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoDecimalConstants.opt.net40.roslyn.il

@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpA279
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpA279.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoDecimalConstants
extends [mscorlib]System.Object
{
.field private static initonly valuetype [mscorlib]System.Decimal constant
.custom instance void [mscorlib]System.Runtime.CompilerServices.DecimalConstantAttribute::.ctor(uint8,
uint8,
uint32,
uint32,
uint32) = ( 01 00 01 00 00 00 00 00 00 00 00 00 0A 00 00 00
00 00 )
.method private hidebysig instance void
MethodWithOptionalParameter([opt] valuetype [mscorlib]System.Decimal parameter) cil managed
{
.param [1]
.custom instance void [mscorlib]System.Runtime.CompilerServices.DecimalConstantAttribute::.ctor(uint8,
uint8,
uint32,
uint32,
uint32) = ( 01 00 01 00 00 00 00 00 00 00 00 00 0A 00 00 00
00 00 )
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method NoDecimalConstants::MethodWithOptionalParameter
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method NoDecimalConstants::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldc.i4.s 10
IL_0002: ldc.i4.0
IL_0003: ldc.i4.0
IL_0004: ldc.i4.0
IL_0005: ldc.i4.1
IL_0006: newobj instance void [mscorlib]System.Decimal::.ctor(int32,
int32,
int32,
bool,
uint8)
IL_000b: stsfld valuetype [mscorlib]System.Decimal ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoDecimalConstants::constant
IL_0010: ret
} // end of method NoDecimalConstants::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoDecimalConstants
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

117
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoExtensionMethods.net40.roslyn.il

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpA29B
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpA29B.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.method assembly hidebysig static class [mscorlib]System.Func`1<!!T>
AsFunc<class T>(!!T 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 23 (0x17)
.maxstack 2
.locals init (class [mscorlib]System.Func`1<!!T> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: ldftn !!0 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods::Return<!!0>(!!0)
IL_000d: newobj instance void class [mscorlib]System.Func`1<!!T>::.ctor(object,
native int)
IL_0012: stloc.0
IL_0013: br.s IL_0015
IL_0015: ldloc.0
IL_0016: ret
} // end of method NoExtensionMethods::AsFunc
.method private hidebysig static !!T Return<T>(!!T 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 7 (0x7)
.maxstack 1
.locals init (!!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method NoExtensionMethods::Return
.method assembly hidebysig static class [mscorlib]System.Func`2<int32,int32>
ExtensionMethodAsStaticFunc() cil managed
{
// Code size 18 (0x12)
.maxstack 2
.locals init (class [mscorlib]System.Func`2<int32,int32> V_0)
IL_0000: nop
IL_0001: ldnull
IL_0002: ldftn !!0 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods::Return<int32>(!!0)
IL_0008: newobj instance void class [mscorlib]System.Func`2<int32,int32>::.ctor(object,
native int)
IL_000d: stloc.0
IL_000e: br.s IL_0010
IL_0010: ldloc.0
IL_0011: ret
} // end of method NoExtensionMethods::ExtensionMethodAsStaticFunc
.method assembly hidebysig static class [mscorlib]System.Func`1<object>
ExtensionMethodBoundToNull() cil managed
{
// Code size 18 (0x12)
.maxstack 2
.locals init (class [mscorlib]System.Func`1<object> V_0)
IL_0000: nop
IL_0001: ldnull
IL_0002: ldftn !!0 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods::Return<object>(!!0)
IL_0008: newobj instance void class [mscorlib]System.Func`1<object>::.ctor(object,
native int)
IL_000d: stloc.0
IL_000e: br.s IL_0010
IL_0010: ldloc.0
IL_0011: ret
} // end of method NoExtensionMethods::ExtensionMethodBoundToNull
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

93
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoExtensionMethods.opt.net40.roslyn.il

@ -0,0 +1,93 @@ @@ -0,0 +1,93 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpA29A
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpA29A.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.method assembly hidebysig static class [mscorlib]System.Func`1<!!T>
AsFunc<class T>(!!T 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 18 (0x12)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: ldftn !!0 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods::Return<!!0>(!!0)
IL_000c: newobj instance void class [mscorlib]System.Func`1<!!T>::.ctor(object,
native int)
IL_0011: ret
} // end of method NoExtensionMethods::AsFunc
.method private hidebysig static !!T Return<T>(!!T 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ret
} // end of method NoExtensionMethods::Return
.method assembly hidebysig static class [mscorlib]System.Func`2<int32,int32>
ExtensionMethodAsStaticFunc() cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldnull
IL_0001: ldftn !!0 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods::Return<int32>(!!0)
IL_0007: newobj instance void class [mscorlib]System.Func`2<int32,int32>::.ctor(object,
native int)
IL_000c: ret
} // end of method NoExtensionMethods::ExtensionMethodAsStaticFunc
.method assembly hidebysig static class [mscorlib]System.Func`1<object>
ExtensionMethodBoundToNull() cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldnull
IL_0001: ldftn !!0 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods::Return<object>(!!0)
IL_0007: newobj instance void class [mscorlib]System.Func`1<object>::.ctor(object,
native int)
IL_000c: ret
} // end of method NoExtensionMethods::ExtensionMethodBoundToNull
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoExtensionMethods
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

145
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoForEachStatement.net40.roslyn.il

@ -0,0 +1,145 @@ @@ -0,0 +1,145 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpA7E1
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpA7E1.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoForEachStatement
extends [mscorlib]System.Object
{
.method public hidebysig static void SimpleNonGenericForeach(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed
{
// Code size 56 (0x38)
.maxstack 1
.locals init (class [mscorlib]System.Collections.IEnumerator V_0,
object V_1,
class [mscorlib]System.IDisposable V_2)
IL_0000: nop
IL_0001: nop
IL_0002: ldarg.0
IL_0003: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator()
IL_0008: stloc.0
.try
{
IL_0009: br.s IL_001b
IL_000b: ldloc.0
IL_000c: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current()
IL_0011: stloc.1
IL_0012: nop
IL_0013: ldloc.1
IL_0014: call void [mscorlib]System.Console::WriteLine(object)
IL_0019: nop
IL_001a: nop
IL_001b: ldloc.0
IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext()
IL_0021: brtrue.s IL_000b
IL_0023: leave.s IL_0037
} // end .try
finally
{
IL_0025: ldloc.0
IL_0026: isinst [mscorlib]System.IDisposable
IL_002b: stloc.2
IL_002c: ldloc.2
IL_002d: brfalse.s IL_0036
IL_002f: ldloc.2
IL_0030: callvirt instance void [mscorlib]System.IDisposable::Dispose()
IL_0035: nop
IL_0036: endfinally
} // end handler
IL_0037: ret
} // end of method NoForEachStatement::SimpleNonGenericForeach
.method public hidebysig static void SimpleForeachOverInts(class [mscorlib]System.Collections.Generic.IEnumerable`1<int32> enumerable) cil managed
{
// Code size 49 (0x31)
.maxstack 1
.locals init (class [mscorlib]System.Collections.Generic.IEnumerator`1<int32> V_0,
int32 V_1)
IL_0000: nop
IL_0001: nop
IL_0002: ldarg.0
IL_0003: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1<!0> class [mscorlib]System.Collections.Generic.IEnumerable`1<int32>::GetEnumerator()
IL_0008: stloc.0
.try
{
IL_0009: br.s IL_001b
IL_000b: ldloc.0
IL_000c: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1<int32>::get_Current()
IL_0011: stloc.1
IL_0012: nop
IL_0013: ldloc.1
IL_0014: call void [mscorlib]System.Console::WriteLine(int32)
IL_0019: nop
IL_001a: nop
IL_001b: ldloc.0
IL_001c: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext()
IL_0021: brtrue.s IL_000b
IL_0023: leave.s IL_0030
} // end .try
finally
{
IL_0025: ldloc.0
IL_0026: brfalse.s IL_002f
IL_0028: ldloc.0
IL_0029: callvirt instance void [mscorlib]System.IDisposable::Dispose()
IL_002e: nop
IL_002f: endfinally
} // end handler
IL_0030: ret
} // end of method NoForEachStatement::SimpleForeachOverInts
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method NoForEachStatement::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoForEachStatement
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

126
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoForEachStatement.opt.net40.roslyn.il

@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpAA15
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpAA15.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoForEachStatement
extends [mscorlib]System.Object
{
.method public hidebysig static void SimpleNonGenericForeach(class [mscorlib]System.Collections.IEnumerable enumerable) cil managed
{
// Code size 48 (0x30)
.maxstack 1
.locals init (class [mscorlib]System.Collections.IEnumerator V_0,
class [mscorlib]System.IDisposable V_1)
IL_0000: ldarg.0
IL_0001: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator()
IL_0006: stloc.0
.try
{
IL_0007: br.s IL_0014
IL_0009: ldloc.0
IL_000a: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current()
IL_000f: call void [mscorlib]System.Console::WriteLine(object)
IL_0014: ldloc.0
IL_0015: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext()
IL_001a: brtrue.s IL_0009
IL_001c: leave.s IL_002f
} // end .try
finally
{
IL_001e: ldloc.0
IL_001f: isinst [mscorlib]System.IDisposable
IL_0024: stloc.1
IL_0025: ldloc.1
IL_0026: brfalse.s IL_002e
IL_0028: ldloc.1
IL_0029: callvirt instance void [mscorlib]System.IDisposable::Dispose()
IL_002e: endfinally
} // end handler
IL_002f: ret
} // end of method NoForEachStatement::SimpleNonGenericForeach
.method public hidebysig static void SimpleForeachOverInts(class [mscorlib]System.Collections.Generic.IEnumerable`1<int32> enumerable) cil managed
{
// Code size 41 (0x29)
.maxstack 1
.locals init (class [mscorlib]System.Collections.Generic.IEnumerator`1<int32> V_0)
IL_0000: ldarg.0
IL_0001: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator`1<!0> class [mscorlib]System.Collections.Generic.IEnumerable`1<int32>::GetEnumerator()
IL_0006: stloc.0
.try
{
IL_0007: br.s IL_0014
IL_0009: ldloc.0
IL_000a: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1<int32>::get_Current()
IL_000f: call void [mscorlib]System.Console::WriteLine(int32)
IL_0014: ldloc.0
IL_0015: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext()
IL_001a: brtrue.s IL_0009
IL_001c: leave.s IL_0028
} // end .try
finally
{
IL_001e: ldloc.0
IL_001f: brfalse.s IL_0027
IL_0021: ldloc.0
IL_0022: callvirt instance void [mscorlib]System.IDisposable::Dispose()
IL_0027: endfinally
} // end handler
IL_0028: ret
} // end of method NoForEachStatement::SimpleForeachOverInts
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method NoForEachStatement::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoForEachStatement
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

179
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoLocalFunctions.net40.roslyn.il

@ -0,0 +1,179 @@ @@ -0,0 +1,179 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpADF1
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpADF1.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle
extends [mscorlib]System.Object
{
.field private initonly class [mscorlib]System.Func`1<int32> _func
.method public hidebysig specialname rtspecialname
instance void .ctor(class [mscorlib]System.Func`1<int32> func) cil managed
{
// Code size 16 (0x10)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: nop
IL_0008: ldarg.0
IL_0009: ldarg.1
IL_000a: stfld class [mscorlib]System.Func`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle::_func
IL_000f: ret
} // end of method Handle::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle
.class public abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions
extends [mscorlib]System.Object
{
.class auto ansi sealed nested private beforefieldinit '<>c__DisplayClass1_0'
extends [mscorlib]System.ValueType
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public int32 x
} // end of class '<>c__DisplayClass1_0'
.class auto ansi sealed nested private beforefieldinit '<>c__DisplayClass2_0'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public int32 x
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method '<>c__DisplayClass2_0'::.ctor
.method assembly hidebysig instance int32
'<SimpleCaptureWithRef>g__F|0'() cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldc.i4.s 42
IL_0002: ldarg.0
IL_0003: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::x
IL_0008: add
IL_0009: ret
} // end of method '<>c__DisplayClass2_0'::'<SimpleCaptureWithRef>g__F|0'
} // end of class '<>c__DisplayClass2_0'
.method private hidebysig static void UseLocalFunctionReference() cil managed
{
// Code size 21 (0x15)
.maxstack 2
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle V_0)
IL_0000: nop
IL_0001: nop
IL_0002: ldnull
IL_0003: ldftn int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions::'<UseLocalFunctionReference>g__F|0_0'()
IL_0009: newobj instance void class [mscorlib]System.Func`1<int32>::.ctor(object,
native int)
IL_000e: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle::.ctor(class [mscorlib]System.Func`1<int32>)
IL_0013: stloc.0
IL_0014: ret
} // end of method NoLocalFunctions::UseLocalFunctionReference
.method private hidebysig static void SimpleCapture() cil managed
{
// Code size 19 (0x13)
.maxstack 2
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0' V_0)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: ldc.i4.1
IL_0004: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'::x
IL_0009: nop
IL_000a: ldloca.s V_0
IL_000c: call int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions::'<SimpleCapture>g__F|1_0'(valuetype ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'&)
IL_0011: pop
IL_0012: ret
} // end of method NoLocalFunctions::SimpleCapture
.method private hidebysig static void SimpleCaptureWithRef() cil managed
{
// Code size 34 (0x22)
.maxstack 2
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0' V_0,
class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle V_1)
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::.ctor()
IL_0005: stloc.0
IL_0006: nop
IL_0007: ldloc.0
IL_0008: ldc.i4.1
IL_0009: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::x
IL_000e: nop
IL_000f: ldloc.0
IL_0010: ldftn instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::'<SimpleCaptureWithRef>g__F|0'()
IL_0016: newobj instance void class [mscorlib]System.Func`1<int32>::.ctor(object,
native int)
IL_001b: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle::.ctor(class [mscorlib]System.Func`1<int32>)
IL_0020: stloc.1
IL_0021: ret
} // end of method NoLocalFunctions::SimpleCaptureWithRef
.method assembly hidebysig static int32
'<UseLocalFunctionReference>g__F|0_0'() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 3 (0x3)
.maxstack 8
IL_0000: ldc.i4.s 42
IL_0002: ret
} // end of method NoLocalFunctions::'<UseLocalFunctionReference>g__F|0_0'
.method assembly hidebysig static int32
'<SimpleCapture>g__F|1_0'(valuetype ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'& A_0) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldc.i4.s 42
IL_0002: ldarg.0
IL_0003: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'::x
IL_0008: add
IL_0009: ret
} // end of method NoLocalFunctions::'<SimpleCapture>g__F|1_0'
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

165
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoLocalFunctions.opt.net40.roslyn.il

@ -0,0 +1,165 @@ @@ -0,0 +1,165 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpAE03
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpAE03.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle
extends [mscorlib]System.Object
{
.field private initonly class [mscorlib]System.Func`1<int32> _func
.method public hidebysig specialname rtspecialname
instance void .ctor(class [mscorlib]System.Func`1<int32> func) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ldarg.0
IL_0007: ldarg.1
IL_0008: stfld class [mscorlib]System.Func`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle::_func
IL_000d: ret
} // end of method Handle::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle
.class public abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions
extends [mscorlib]System.Object
{
.class auto ansi sealed nested private beforefieldinit '<>c__DisplayClass1_0'
extends [mscorlib]System.ValueType
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public int32 x
} // end of class '<>c__DisplayClass1_0'
.class auto ansi sealed nested private beforefieldinit '<>c__DisplayClass2_0'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public int32 x
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method '<>c__DisplayClass2_0'::.ctor
.method assembly hidebysig instance int32
'<SimpleCaptureWithRef>g__F|0'() cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldc.i4.s 42
IL_0002: ldarg.0
IL_0003: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::x
IL_0008: add
IL_0009: ret
} // end of method '<>c__DisplayClass2_0'::'<SimpleCaptureWithRef>g__F|0'
} // end of class '<>c__DisplayClass2_0'
.method private hidebysig static void UseLocalFunctionReference() cil managed
{
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldnull
IL_0001: ldftn int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions::'<UseLocalFunctionReference>g__F|0_0'()
IL_0007: newobj instance void class [mscorlib]System.Func`1<int32>::.ctor(object,
native int)
IL_000c: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle::.ctor(class [mscorlib]System.Func`1<int32>)
IL_0011: pop
IL_0012: ret
} // end of method NoLocalFunctions::UseLocalFunctionReference
.method private hidebysig static void SimpleCapture() cil managed
{
// Code size 17 (0x11)
.maxstack 2
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0' V_0)
IL_0000: ldloca.s V_0
IL_0002: ldc.i4.1
IL_0003: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'::x
IL_0008: ldloca.s V_0
IL_000a: call int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions::'<SimpleCapture>g__F|1_0'(valuetype ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'&)
IL_000f: pop
IL_0010: ret
} // end of method NoLocalFunctions::SimpleCapture
.method private hidebysig static void SimpleCaptureWithRef() cil managed
{
// Code size 30 (0x1e)
.maxstack 8
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::.ctor()
IL_0005: dup
IL_0006: ldc.i4.1
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::x
IL_000c: ldftn instance int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass2_0'::'<SimpleCaptureWithRef>g__F|0'()
IL_0012: newobj instance void class [mscorlib]System.Func`1<int32>::.ctor(object,
native int)
IL_0017: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.Handle::.ctor(class [mscorlib]System.Func`1<int32>)
IL_001c: pop
IL_001d: ret
} // end of method NoLocalFunctions::SimpleCaptureWithRef
.method assembly hidebysig static int32
'<UseLocalFunctionReference>g__F|0_0'() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 3 (0x3)
.maxstack 8
IL_0000: ldc.i4.s 42
IL_0002: ret
} // end of method NoLocalFunctions::'<UseLocalFunctionReference>g__F|0_0'
.method assembly hidebysig static int32
'<SimpleCapture>g__F|1_0'(valuetype ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'& A_0) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldc.i4.s 42
IL_0002: ldarg.0
IL_0003: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions/'<>c__DisplayClass1_0'::x
IL_0008: add
IL_0009: ret
} // end of method NoLocalFunctions::'<SimpleCapture>g__F|1_0'
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoLocalFunctions
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

133
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoPropertiesAndEvents.net40.roslyn.il

@ -0,0 +1,133 @@ @@ -0,0 +1,133 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpB115
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpB115.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents
extends [mscorlib]System.Object
{
.field private class [mscorlib]System.EventHandler MyEvent
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 )
.method public hidebysig specialname instance void
add_MyEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 41 (0x29)
.maxstack 3
.locals init (class [mscorlib]System.EventHandler V_0,
class [mscorlib]System.EventHandler V_1,
class [mscorlib]System.EventHandler V_2)
IL_0000: ldarg.0
IL_0001: ldfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: ldloc.1
IL_000a: ldarg.1
IL_000b: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Combine(class [mscorlib]System.Delegate,
class [mscorlib]System.Delegate)
IL_0010: castclass [mscorlib]System.EventHandler
IL_0015: stloc.2
IL_0016: ldarg.0
IL_0017: ldflda class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_001c: ldloc.2
IL_001d: ldloc.1
IL_001e: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class [mscorlib]System.EventHandler>(!!0&,
!!0,
!!0)
IL_0023: stloc.0
IL_0024: ldloc.0
IL_0025: ldloc.1
IL_0026: bne.un.s IL_0007
IL_0028: ret
} // end of method NoPropertiesAndEvents::add_MyEvent
.method public hidebysig specialname instance void
remove_MyEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 41 (0x29)
.maxstack 3
.locals init (class [mscorlib]System.EventHandler V_0,
class [mscorlib]System.EventHandler V_1,
class [mscorlib]System.EventHandler V_2)
IL_0000: ldarg.0
IL_0001: ldfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: ldloc.1
IL_000a: ldarg.1
IL_000b: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Remove(class [mscorlib]System.Delegate,
class [mscorlib]System.Delegate)
IL_0010: castclass [mscorlib]System.EventHandler
IL_0015: stloc.2
IL_0016: ldarg.0
IL_0017: ldflda class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_001c: ldloc.2
IL_001d: ldloc.1
IL_001e: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class [mscorlib]System.EventHandler>(!!0&,
!!0,
!!0)
IL_0023: stloc.0
IL_0024: ldloc.0
IL_0025: ldloc.1
IL_0026: bne.un.s IL_0007
IL_0028: ret
} // end of method NoPropertiesAndEvents::remove_MyEvent
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method NoPropertiesAndEvents::.ctor
.event [mscorlib]System.EventHandler MyEvent
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::add_MyEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::remove_MyEvent(class [mscorlib]System.EventHandler)
} // end of event NoPropertiesAndEvents::MyEvent
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

131
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoPropertiesAndEvents.opt.net40.roslyn.il

@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tmpB126
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpB126.tmp
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents
extends [mscorlib]System.Object
{
.field private class [mscorlib]System.EventHandler MyEvent
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.method public hidebysig specialname instance void
add_MyEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 41 (0x29)
.maxstack 3
.locals init (class [mscorlib]System.EventHandler V_0,
class [mscorlib]System.EventHandler V_1,
class [mscorlib]System.EventHandler V_2)
IL_0000: ldarg.0
IL_0001: ldfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: ldloc.1
IL_000a: ldarg.1
IL_000b: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Combine(class [mscorlib]System.Delegate,
class [mscorlib]System.Delegate)
IL_0010: castclass [mscorlib]System.EventHandler
IL_0015: stloc.2
IL_0016: ldarg.0
IL_0017: ldflda class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_001c: ldloc.2
IL_001d: ldloc.1
IL_001e: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class [mscorlib]System.EventHandler>(!!0&,
!!0,
!!0)
IL_0023: stloc.0
IL_0024: ldloc.0
IL_0025: ldloc.1
IL_0026: bne.un.s IL_0007
IL_0028: ret
} // end of method NoPropertiesAndEvents::add_MyEvent
.method public hidebysig specialname instance void
remove_MyEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 41 (0x29)
.maxstack 3
.locals init (class [mscorlib]System.EventHandler V_0,
class [mscorlib]System.EventHandler V_1,
class [mscorlib]System.EventHandler V_2)
IL_0000: ldarg.0
IL_0001: ldfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: ldloc.1
IL_000a: ldarg.1
IL_000b: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Remove(class [mscorlib]System.Delegate,
class [mscorlib]System.Delegate)
IL_0010: castclass [mscorlib]System.EventHandler
IL_0015: stloc.2
IL_0016: ldarg.0
IL_0017: ldflda class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::MyEvent
IL_001c: ldloc.2
IL_001d: ldloc.1
IL_001e: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class [mscorlib]System.EventHandler>(!!0&,
!!0,
!!0)
IL_0023: stloc.0
IL_0024: ldloc.0
IL_0025: ldloc.1
IL_0026: bne.un.s IL_0007
IL_0028: ret
} // end of method NoPropertiesAndEvents::remove_MyEvent
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method NoPropertiesAndEvents::.ctor
.event [mscorlib]System.EventHandler MyEvent
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::add_MyEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents::remove_MyEvent(class [mscorlib]System.EventHandler)
} // end of event NoPropertiesAndEvents::MyEvent
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Ugly.NoPropertiesAndEvents
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

4
ICSharpCode.Decompiler.Tests/UglyTestRunner.cs

@ -60,6 +60,8 @@ namespace ICSharpCode.Decompiler.Tests @@ -60,6 +60,8 @@ namespace ICSharpCode.Decompiler.Tests
static readonly CompilerOptions[] roslynOnlyOptions =
{
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
@ -68,6 +70,8 @@ namespace ICSharpCode.Decompiler.Tests @@ -68,6 +70,8 @@ namespace ICSharpCode.Decompiler.Tests
{
CompilerOptions.None,
CompilerOptions.Optimize,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};

16
ICSharpCode.Decompiler.Tests/VBPrettyTestRunner.cs

@ -55,6 +55,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -55,6 +55,14 @@ namespace ICSharpCode.Decompiler.Tests
{
CompilerOptions.None,
CompilerOptions.Optimize,
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,
@ -65,6 +73,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -65,6 +73,14 @@ namespace ICSharpCode.Decompiler.Tests
static readonly CompilerOptions[] roslynOnlyOptions =
{
CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn2_10_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0 | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest | CompilerOptions.TargetNet40,
CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn1_3_2,
CompilerOptions.UseRoslyn2_10_0,

2
ILSpy.BamlDecompiler.Tests/BamlTestRunner.cs

@ -160,7 +160,7 @@ namespace ILSpy.BamlDecompiler.Tests @@ -160,7 +160,7 @@ namespace ILSpy.BamlDecompiler.Tests
RunTest(name, typeof(BamlTestRunner).Assembly.Location,
Path.Combine(
Path.GetDirectoryName(typeof(BamlTestRunner).Assembly.Location),
"../../../../ILSpy.BamlDecompiler.Tests", name + ".xaml"));
"../../../..", name + ".xaml"));
}
void RunTest(string name, string asmPath, string sourcePath)

10
ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj

@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<IsPackable>false</IsPackable>
<StartupObject>AutoGeneratedProgram</StartupObject>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<EnableDefaultItems>false</EnableDefaultItems>
<UseWpf>true</UseWpf>
@ -27,13 +27,6 @@ @@ -27,13 +27,6 @@
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Import Project="..\packages.props" />
<ItemGroup>
@ -72,7 +65,6 @@ @@ -72,7 +65,6 @@
<DependentUpon>SimpleNames.xaml</DependentUpon>
</Compile>
<Compile Include="Mocks\AvalonDock.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

30
ILSpy.BamlDecompiler.Tests/Properties/AssemblyInfo.cs

@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
#region Using directives
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ILSpy.BamlDecompiler.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ILSpy.BamlDecompiler.Tests")]
[assembly: AssemblyCopyright("Copyright 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]

2
packages.props

@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
<SystemCompositionVersion>5.0.1</SystemCompositionVersion>
<!-- Microsoft.NETCore.ILAsm -->
<ILAsmVersion>6.0.0</ILAsmVersion>
<!-- Microsoft.NETCore.ILDAsm -->
<ILDAsmVersion>6.0.0</ILDAsmVersion>
<!-- Microsoft.CodeAnalysis.* -->
<RoslynVersion>4.0.1</RoslynVersion>
<MonoCecilVersion>0.11.4</MonoCecilVersion>

Loading…
Cancel
Save