Browse Source

Merge branch 'origin/master' into nullable-reference-types

pull/1425/head
Daniel Grunwald 6 years ago
parent
commit
45ae1ed998
  1. 2
      ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
  2. 186
      ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs
  3. 21
      ICSharpCode.Decompiler.Console/LICENSE
  4. 143
      ICSharpCode.Decompiler.Console/Program.cs
  5. 13
      ICSharpCode.Decompiler.Console/ProgramExitCodes.cs
  6. 3
      ICSharpCode.Decompiler.Console/Publish.cmd
  7. 37
      ICSharpCode.Decompiler.Console/README.md
  8. BIN
      ICSharpCode.Decompiler.Console/Running.gif
  9. 1
      ICSharpCode.Decompiler.Console/TypesParser.cs
  10. 19
      ICSharpCode.Decompiler.Console/ValidationAttributes.cs
  11. 133
      ICSharpCode.Decompiler.Tests/CodeSampleFileParser.cs
  12. 6
      ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs
  13. 165
      ICSharpCode.Decompiler.Tests/Generics.cs
  14. 55
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  15. 23
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  16. 51
      ICSharpCode.Decompiler.Tests/IL/ILTests.cs
  17. BIN
      ICSharpCode.Decompiler.Tests/IL/SequenceOfNestedIfs.dll
  18. BIN
      ICSharpCode.Decompiler.Tests/IL/StackTests.exe
  19. 12
      ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
  20. 254
      ICSharpCode.Decompiler.Tests/IncrementDecrement.cs
  21. 111
      ICSharpCode.Decompiler.Tests/PdbGenerationTestRunner.cs
  22. 39
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  23. 18
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs
  24. 0
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/StackTests.il
  25. 28
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs
  26. 74
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.il
  27. 32
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/SequenceOfNestedIfs.cs
  28. 0
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/SequenceOfNestedIfs.il
  29. 4
      ICSharpCode.Decompiler.Tests/TestCases/PdbGen/.gitignore
  30. 73
      ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml
  31. 36
      ICSharpCode.Decompiler.Tests/TestCases/PdbGen/HelloWorld.xml
  32. 63
      ICSharpCode.Decompiler.Tests/TestCases/PdbGen/LambdaCapturing.xml
  33. 128
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs
  34. 517
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.il
  35. 398
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il
  36. 398
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il
  37. 517
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il
  38. 13
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributeSamples.cs
  39. 4
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes.cs
  40. 43
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.cs
  41. 166
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.il
  42. 142
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.opt.il
  43. 146
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.opt.roslyn.il
  44. 163
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.roslyn.il
  45. 42
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Discards.cs
  46. 178
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Discards.opt.roslyn.il
  47. 190
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Discards.roslyn.il
  48. 119
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.cs
  49. 242
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.il
  50. 194
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.opt.il
  51. 198
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.opt.roslyn.il
  52. 247
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.roslyn.il
  53. 156
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.cs
  54. 489
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.il
  55. 393
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.il
  56. 399
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.roslyn.il
  57. 507
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.roslyn.il
  58. 27
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs
  59. 191
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.roslyn.il
  60. 191
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.roslyn.il
  61. 17
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.cs
  62. 48
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.il
  63. 48
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.il
  64. 48
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.roslyn.il
  65. 49
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.roslyn.il
  66. 4
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/MemberTests.cs
  67. 56
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.cs
  68. 214
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.il
  69. 197
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.il
  70. 201
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.roslyn.il
  71. 219
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.roslyn.il
  72. 12
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs
  73. 32
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.roslyn.il
  74. 55
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.cs
  75. 154
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.il
  76. 125
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.il
  77. 113
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.roslyn.il
  78. 138
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.roslyn.il
  79. 6
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.cs
  80. 25
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.il
  81. 24
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.opt.il
  82. 24
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.opt.roslyn.il
  83. 26
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.roslyn.il
  84. 945
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.cs
  85. 3801
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.il
  86. 3392
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.opt.il
  87. 3411
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.opt.roslyn.il
  88. 3727
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.roslyn.il
  89. 54
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.cs
  90. 247
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.il
  91. 221
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.opt.il
  92. 207
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.opt.roslyn.il
  93. 242
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.roslyn.il
  94. 186
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs
  95. 511
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.il
  96. 394
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.opt.il
  97. 392
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.opt.roslyn.il
  98. 511
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.roslyn.il
  99. 14
      ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoArrayInitializers.Expected.cs
  100. 18
      ICSharpCode.Decompiler.Tests/Types/EnumTests.cs
  101. Some files were not shown because too many files have changed in this diff Show More

2
ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.5" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.3.2" />
<PackageReference Include="ICSharpCode.Decompiler" Version="4.0.0.4521" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />

186
ICSharpCode.Decompiler.Console/IlspyCmdProgram.cs

@ -0,0 +1,186 @@ @@ -0,0 +1,186 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using McMaster.Extensions.CommandLineUtils;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.Disassembler;
using System.Threading;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using ICSharpCode.Decompiler.DebugInfo;
// ReSharper disable All
namespace ICSharpCode.Decompiler.Console
{
[Command(Name = "ilspycmd", Description = "dotnet tool for decompiling .NET assemblies and generating portable PDBs",
ExtendedHelpText = @"
Remarks:
-o is valid with every option and required when using -p.
")]
[HelpOption("-h|--help")]
[ProjectOptionRequiresOutputDirectoryValidationAttribute]
class ILSpyCmdProgram
{
public static int Main(string[] args) => CommandLineApplication.Execute<ILSpyCmdProgram>(args);
[FileExists]
[Required]
[Argument(0, "Assembly file name", "The assembly that is being decompiled. This argument is mandatory.")]
public string InputAssemblyName { get; }
[DirectoryExists]
[Option("-o|--outputdir <directory>", "The output directory, if omitted decompiler output is written to standard out.", CommandOptionType.SingleValue)]
public string OutputDirectory { get; }
[Option("-p|--project", "Decompile assembly as compilable project. This requires the output directory option.", CommandOptionType.NoValue)]
public bool CreateCompilableProjectFlag { get; }
[Option("-t|--type <type-name>", "The fully qualified name of the type to decompile.", CommandOptionType.SingleValue)]
public string TypeName { get; }
[Option("-il|--ilcode", "Show IL code.", CommandOptionType.NoValue)]
public bool ShowILCodeFlag { get; }
[Option("-d|--debuginfo", "Generate PDB.", CommandOptionType.NoValue)]
public bool CreteDebugInfoFlag { get; }
[Option("-l|--list <entity-type(s)>", "Lists all entities of the specified type(s). Valid types: c(lass), i(interface), s(truct), d(elegate), e(num)", CommandOptionType.MultipleValue)]
public string[] EntityTypes { get; } = new string[0];
[Option("-v|--version", "Show version of ICSharpCode.Decompiler used.", CommandOptionType.NoValue)]
public bool ShowVersion { get; }
private int OnExecute(CommandLineApplication app)
{
TextWriter output = System.Console.Out;
bool outputDirectorySpecified = !String.IsNullOrEmpty(OutputDirectory);
try {
if (CreateCompilableProjectFlag) {
DecompileAsProject(InputAssemblyName, OutputDirectory);
} else if (EntityTypes.Any()) {
var values = EntityTypes.SelectMany(v => v.Split(',', ';')).ToArray();
HashSet<TypeKind> kinds = TypesParser.ParseSelection(values);
if (outputDirectorySpecified) {
string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
output = File.CreateText(Path.Combine(OutputDirectory, outputName) + ".list.txt");
}
ListContent(InputAssemblyName, output, kinds);
} else if (ShowILCodeFlag) {
if (outputDirectorySpecified) {
string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
output = File.CreateText(Path.Combine(OutputDirectory, outputName) + ".il");
}
ShowIL(InputAssemblyName, output);
} else if (CreteDebugInfoFlag) {
string pdbFileName = null;
if (outputDirectorySpecified) {
string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
pdbFileName = Path.Combine(OutputDirectory, outputName) + ".pdb";
} else {
pdbFileName = Path.ChangeExtension(InputAssemblyName, ".pdb");
}
return GeneratePdbForAssembly(InputAssemblyName, pdbFileName, app);
} else if (ShowVersion) {
string vInfo = "ilspycmd: " + typeof(ILSpyCmdProgram).Assembly.GetName().Version.ToString() +
Environment.NewLine
+ "ICSharpCode.Decompiler: " +
typeof(FullTypeName).Assembly.GetName().Version.ToString();
output.WriteLine(vInfo);
} else {
if (outputDirectorySpecified) {
string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
output = File.CreateText(Path.Combine(OutputDirectory,
(String.IsNullOrEmpty(TypeName) ? outputName : TypeName) + ".decompiled.cs"));
}
Decompile(InputAssemblyName, output, TypeName);
}
} catch (Exception ex) {
app.Error.WriteLine(ex.ToString());
return ProgramExitCodes.EX_SOFTWARE;
} finally {
output.Close();
}
return 0;
}
static CSharpDecompiler GetDecompiler(string assemblyFileName)
{
return new CSharpDecompiler(assemblyFileName, new DecompilerSettings() { ThrowOnAssemblyResolveErrors = false });
}
static void ListContent(string assemblyFileName, TextWriter output, ISet<TypeKind> kinds)
{
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
foreach (var type in decompiler.TypeSystem.MainModule.TypeDefinitions) {
if (!kinds.Contains(type.Kind))
continue;
output.WriteLine($"{type.Kind} {type.FullName}");
}
}
static void ShowIL(string assemblyFileName, TextWriter output)
{
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
ITextOutput textOutput = new PlainTextOutput();
ReflectionDisassembler disassembler = new ReflectionDisassembler(textOutput, CancellationToken.None);
disassembler.DisassembleNamespace(decompiler.TypeSystem.MainModule.RootNamespace.Name,
decompiler.TypeSystem.MainModule.PEFile,
decompiler.TypeSystem.MainModule.TypeDefinitions.Select(x => (TypeDefinitionHandle)x.MetadataToken));
output.WriteLine($"// IL code: {decompiler.TypeSystem.MainModule.AssemblyName}");
output.WriteLine(textOutput.ToString());
}
static void DecompileAsProject(string assemblyFileName, string outputDirectory)
{
WholeProjectDecompiler decompiler = new WholeProjectDecompiler();
var module = new PEFile(assemblyFileName);
decompiler.AssemblyResolver = new UniversalAssemblyResolver(assemblyFileName, false, module.Reader.DetectTargetFrameworkId());
decompiler.DecompileProject(module, outputDirectory);
}
static void Decompile(string assemblyFileName, TextWriter output, string typeName = null)
{
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
if (typeName == null) {
output.Write(decompiler.DecompileWholeModuleAsString());
} else {
var name = new FullTypeName(typeName);
output.Write(decompiler.DecompileTypeAsString(name));
}
}
static int GeneratePdbForAssembly(string assemblyFileName, string pdbFileName, CommandLineApplication app)
{
var module = new PEFile(assemblyFileName,
new FileStream(assemblyFileName, FileMode.Open, FileAccess.Read),
PEStreamOptions.PrefetchEntireImage,
metadataOptions: MetadataReaderOptions.None);
if (!PortablePdbWriter.HasCodeViewDebugDirectoryEntry(module)) {
app.Error.WriteLine($"Cannot create PDB file for {assemblyFileName}, because it does not contain a PE Debug Directory Entry of type 'CodeView'.");
return ProgramExitCodes.EX_DATAERR;
}
using (FileStream stream = new FileStream(pdbFileName, FileMode.OpenOrCreate, FileAccess.Write)) {
var decompiler = GetDecompiler(assemblyFileName);
PortablePdbWriter.WritePdb(module, decompiler, new DecompilerSettings() { ThrowOnAssemblyResolveErrors = false }, stream);
}
return 0;
}
}
}

21
ICSharpCode.Decompiler.Console/LICENSE

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 Christoph Wille
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

143
ICSharpCode.Decompiler.Console/Program.cs

@ -1,143 +0,0 @@ @@ -1,143 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using McMaster.Extensions.CommandLineUtils;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.Disassembler;
using System.Threading;
using System.Reflection.Metadata;
namespace ICSharpCode.Decompiler.Console
{
class Program
{
static int Main(string[] args)
{
// https://github.com/natemcmaster/CommandLineUtils/
// Older cmd line clients (for options reference): https://github.com/aerror2/ILSpy-For-MacOSX and https://github.com/andreif/ILSpyMono
var app = new CommandLineApplication();
app.LongVersionGetter = () => "ilspycmd " + typeof(FullTypeName).Assembly.GetName().Version.ToString();
app.HelpOption("-h|--help");
var inputAssemblyFileName = app.Argument("Assembly filename name", "The assembly that is being decompiled. This argument is mandatory.");
var projectOption = app.Option("-p|--project", "Decompile assembly as compilable project. This requires the output directory option.", CommandOptionType.NoValue);
var outputOption = app.Option("-o|--outputdir <directory>", "The output directory, if omitted decompiler output is written to standard out.", CommandOptionType.SingleValue);
var typeOption = app.Option("-t|--type <type-name>", "The fully qualified name of the type to decompile.", CommandOptionType.SingleValue);
var listOption = app.Option("-l|--list <entity-type(s)>", "Lists all entities of the specified type(s). Valid types: c(lass), i(interface), s(truct), d(elegate), e(num)", CommandOptionType.MultipleValue);
var ilViewerOption = app.Option("-il|--ilcode", "Show IL code.", CommandOptionType.NoValue);
app.ExtendedHelpText = Environment.NewLine + "-o is valid with every option and required when using -p.";
app.ThrowOnUnexpectedArgument = false; // Ignore invalid arguments / options
app.OnExecute(() => {
// HACK : the CommandLineUtils package does not allow us to specify an argument as mandatory.
// Therefore we're implementing it as simple as possible.
if (inputAssemblyFileName.Value == null) {
app.ShowVersion();
app.ShowHint();
return -1;
}
if (!File.Exists(inputAssemblyFileName.Value)) {
app.Error.WriteLine($"ERROR: Input file not found.");
return -1;
}
if (!outputOption.HasValue() && projectOption.HasValue()) {
app.Error.WriteLine($"ERROR: Output directory not speciified.");
return -1;
}
if (outputOption.HasValue() && !Directory.Exists(outputOption.Value())) {
app.Error.WriteLine($"ERROR: Output directory '{outputOption.Value()}' does not exist.");
return -1;
}
TextWriter output = System.Console.Out;
try {
if (projectOption.HasValue()) {
DecompileAsProject(inputAssemblyFileName.Value, outputOption.Value());
} else if (listOption.HasValue()) {
var values = listOption.Values.SelectMany(v => v.Split(',', ';')).ToArray();
HashSet<TypeKind> kinds = TypesParser.ParseSelection(values);
if (outputOption.HasValue()) {
string directory = outputOption.Value();
string outputName = Path.GetFileNameWithoutExtension(inputAssemblyFileName.Value);
output = File.CreateText(Path.Combine(directory, outputName) + ".list.txt");
}
ListContent(inputAssemblyFileName.Value, output, kinds);
} else if (ilViewerOption.HasValue()) {
if (outputOption.HasValue()) {
string directory = outputOption.Value();
string outputName = Path.GetFileNameWithoutExtension(inputAssemblyFileName.Value);
output = File.CreateText(Path.Combine(directory, outputName) + ".il");
}
ShowIL(inputAssemblyFileName.Value, output);
} else {
if (outputOption.HasValue()) {
string directory = outputOption.Value();
string outputName = Path.GetFileNameWithoutExtension(inputAssemblyFileName.Value);
output = File.CreateText(Path.Combine(directory, (typeOption.Value() ?? outputName) + ".decompiled.cs"));
}
Decompile(inputAssemblyFileName.Value, output, typeOption.Value());
}
} finally {
output.Close();
}
// do not use Console here!
return 0;
});
return app.Execute(args);
}
static CSharpDecompiler GetDecompiler(string assemblyFileName)
{
return new CSharpDecompiler(assemblyFileName, new DecompilerSettings() { ThrowOnAssemblyResolveErrors = false });
}
static void ListContent(string assemblyFileName, TextWriter output, ISet<TypeKind> kinds)
{
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
foreach (var type in decompiler.TypeSystem.MainModule.TypeDefinitions) {
if (!kinds.Contains(type.Kind))
continue;
output.WriteLine($"{type.Kind} {type.FullName}");
}
}
static void ShowIL(string assemblyFileName, TextWriter output)
{
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
ITextOutput textOutput = new PlainTextOutput();
ReflectionDisassembler disassembler = new ReflectionDisassembler(textOutput, CancellationToken.None);
disassembler.DisassembleNamespace(decompiler.TypeSystem.MainModule.RootNamespace.Name,
decompiler.TypeSystem.MainModule.PEFile,
decompiler.TypeSystem.MainModule.TypeDefinitions.Select(x => (TypeDefinitionHandle)x.MetadataToken));
output.WriteLine($"// IL code: {decompiler.TypeSystem.MainModule.AssemblyName}");
output.WriteLine(textOutput.ToString());
}
static void DecompileAsProject(string assemblyFileName, string outputDirectory)
{
WholeProjectDecompiler decompiler = new WholeProjectDecompiler();
var module = new PEFile(assemblyFileName);
decompiler.AssemblyResolver = new UniversalAssemblyResolver(assemblyFileName, false, module.Reader.DetectTargetFrameworkId());
decompiler.DecompileProject(module, outputDirectory);
}
static void Decompile(string assemblyFileName, TextWriter output, string typeName = null)
{
CSharpDecompiler decompiler = GetDecompiler(assemblyFileName);
if (typeName == null) {
output.Write(decompiler.DecompileWholeModuleAsString());
} else {
var name = new FullTypeName(typeName);
output.Write(decompiler.DecompileTypeAsString(name));
}
}
}
}

13
ICSharpCode.Decompiler.Console/ProgramExitCodes.cs

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
// ReSharper disable InconsistentNaming
namespace ICSharpCode.Decompiler.Console
{
public class ProgramExitCodes
{
// https://www.freebsd.org/cgi/man.cgi?query=sysexits
public const int EX_USAGE = 64;
public const int EX_DATAERR = 65;
public const int EX_NOINPUT = 66;
public const int EX_SOFTWARE = 70;
}
}

3
ICSharpCode.Decompiler.Console/Publish.cmd

@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
dotnet publish -c release -r win7-x64
dotnet publish -c release -r osx-x64
dotnet publish -c release -r linux-x64

37
ICSharpCode.Decompiler.Console/README.md

@ -9,38 +9,23 @@ dotnet tool install ilspycmd -g @@ -9,38 +9,23 @@ dotnet tool install ilspycmd -g
```
ilspycmd -h
Usage: [arguments] [options]
dotnet tool for decompiling .NET assemblies and generating portable PDBs
Usage: ilspycmd [arguments] [options]
Arguments:
Assembly filename name The assembly that is being decompiled. This argument is mandatory.
Assembly file name The assembly that is being decompiled. This argument is mandatory.
Options:
-h|--help Show help information
-p|--project Decompile assembly as compilable project. This requires the output directory option.
-o|--outputdir <directory> The output directory, if omitted decompiler output is written to standard out.
-p|--project Decompile assembly as compilable project. This requires the output directory option.
-t|--type <type-name> The fully qualified name of the type to decompile.
-l|--list <entity-type(s)> Lists all entities of the specified type(s). Valid types: c(lass), i(interface), s(truct),
d(elegate), e(num)
-il|--ilcode Show IL code.
-o is valid with every option and required when using -p.
```
![dotnet-build-dance](Running.gif)
## X-Plat Notes
[SCD Article](https://www.hanselman.com/blog/SelfcontainedNETCoreApplications.aspx)
[RuntimeIdentifiers csproj documentation](https://docs.microsoft.com/en-us/dotnet/core/tools/csproj#additions)
[RID catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)
```
dotnet build -r win10-x64
dotnet build -r osx-x64
dotnet publish -c release -r win10-x64
dotnet publish -c release -r osx-x64
-il|--ilcode Show IL code.
-d|--debuginfo Generate PDB.
-l|--list <entity-type(s)> Lists all entities of the specified type(s). Valid types: c(lass), i(interface), s(truct), d(elegate), e(num)
-v|--version Show version of ICSharpCode.Decompiler used.
PS \ilspy-console-netcoreapp\src\ilspycmd\bin\Release\netcoreapp2.0\win10-x64\publish> ./ilspycmd.exe ilspycmd.dll
Remarks:
-o is valid with every option and required when using -p.
```

BIN
ICSharpCode.Decompiler.Console/Running.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

1
ICSharpCode.Decompiler.Console/TypesParser.cs

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICSharpCode.Decompiler.TypeSystem;
namespace ICSharpCode.Decompiler.Console

19
ICSharpCode.Decompiler.Console/ValidationAttributes.cs

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace ICSharpCode.Decompiler.Console
{
[AttributeUsage(AttributeTargets.Class)]
public class ProjectOptionRequiresOutputDirectoryValidationAttribute : ValidationAttribute
{
protected override ValidationResult IsValid(object value, ValidationContext context)
{
if (value is ILSpyCmdProgram obj) {
if (obj.CreateCompilableProjectFlag && String.IsNullOrEmpty(obj.OutputDirectory)) {
return new ValidationResult("--project cannot be used unless --outputdir is also specified");
}
}
return ValidationResult.Success;
}
}
}

133
ICSharpCode.Decompiler.Tests/CodeSampleFileParser.cs

@ -1,133 +0,0 @@ @@ -1,133 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ICSharpCode.Decompiler.Tests
{
static class CodeSampleFileParser
{
public static IEnumerable<string> ListSections(string s)
{
var query = from line in ToLines(s)
let sectionName = ReadSectionName(line)
where sectionName != null
select sectionName;
return query;
}
public static string GetSection(string sectionName, string s)
{
var lines = ToLines(s);
bool sectionFound = false;
var sectionText = new StringBuilder();
Action<string> parser = null;
Action<string> commonSectionReader = line =>
{
if (IsCommonSectionEnd(line))
parser = null;
else
sectionText.AppendLine(line);
};
Action<string> namedSectionReader = line =>
{
string name = ReadSectionName(line);
if (name == null)
sectionText.AppendLine(line);
else if (name != sectionName)
parser = null;
};
Action<string> defaultReader = line =>
{
if (IsCommonSectionStart(line))
parser = commonSectionReader;
else if (ReadSectionName(line) == sectionName)
{
parser = namedSectionReader;
sectionFound = true;
}
};
foreach(var line in lines)
{
(parser ?? defaultReader)(line);
}
if (sectionFound)
return sectionText.ToString();
else
return "";
}
public static bool IsCommentOrBlank(string s)
{
if(String.IsNullOrWhiteSpace(s))
return true;
s = s.Trim();
return s.StartsWith("//") || s.StartsWith("#"); // Also ignore #pragmas for warning suppression
}
public static string ConcatLines(IEnumerable<string> lines)
{
var buffer = new StringBuilder();
foreach (var line in lines)
{
buffer.AppendLine(line);
}
return buffer.ToString();
}
static string ReadSectionName(string line)
{
line = line.TrimStart();
if (line.StartsWith("//$$"))
return line.Substring(4).Trim();
else
return null;
}
static bool IsCommonSectionStart(string line)
{
return line.Trim() == "//$CS";
}
static bool IsCommonSectionEnd(string line)
{
return line.Trim() == "//$CE";
}
static IEnumerable<string> ToLines(string s)
{
var reader = new StringReader(s);
string line;
while ((line = reader.ReadLine()) != null)
{
yield return line;
}
}
}
}

6
ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs

@ -220,6 +220,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -220,6 +220,12 @@ namespace ICSharpCode.Decompiler.Tests
RunIL("Jmp.il");
}
[Test]
public void StackTests()
{
RunIL("StackTests.il");
}
[Test]
public void StackTypes([Values(false, true)] bool force32Bit)
{

165
ICSharpCode.Decompiler.Tests/Generics.cs

@ -1,165 +0,0 @@ @@ -1,165 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
public static class Generics
{
public class MyArray<T>
{
public class NestedClass<Y>
{
public T Item1;
public Y Item2;
}
public enum NestedEnum
{
A,
B
}
private T[] arr;
public MyArray(int capacity)
{
this.arr = new T[capacity];
}
public void Size(int capacity)
{
Array.Resize<T>(ref this.arr, capacity);
}
public void Grow(int capacity)
{
if (capacity >= this.arr.Length)
{
this.Size(capacity);
}
}
}
public interface IInterface
{
void Method1<T>() where T : class;
void Method2<T>() where T : class;
}
public abstract class Base : Generics.IInterface
{
// constraints must be repeated on implicit interface implementation
public abstract void Method1<T>() where T : class;
// constraints must not be specified on explicit interface implementation
void Generics.IInterface.Method2<T>()
{
}
}
public class Derived : Generics.Base
{
// constraints are inherited automatically and must not be specified
public override void Method1<T>()
{
}
}
private const Generics.MyArray<string>.NestedEnum enumVal = Generics.MyArray<string>.NestedEnum.A;
private static Type type1 = typeof(List<>);
private static Type type2 = typeof(Generics.MyArray<>);
private static Type type3 = typeof(List<>.Enumerator);
private static Type type4 = typeof(Generics.MyArray<>.NestedClass<>);
private static Type type5 = typeof(List<int>[]);
private static Type type6 = typeof(Generics.MyArray<>.NestedEnum);
public static void MethodWithConstraint<T, S>() where T : class, S where S : ICloneable, new()
{
}
public static void MethodWithStructConstraint<T>() where T : struct
{
}
private static void MultidimensionalArray<T>(T[,] array)
{
array[0, 0] = array[0, 1];
}
public static Dictionary<string, string>.KeyCollection.Enumerator GetEnumerator(Dictionary<string, string> d, Generics.MyArray<string>.NestedClass<int> nc)
{
// Tests references to inner classes in generic classes
return d.Keys.GetEnumerator();
}
public static bool IsString<T>(T input)
{
return input is string;
}
public static string AsString<T>(T input)
{
return input as string;
}
public static string CastToString<T>(T input)
{
return (string)((object)input);
}
public static T CastFromString<T>(string input)
{
return (T)((object)input);
}
public static bool IsInt<T>(T input)
{
return input is int;
}
public static int CastToInt<T>(T input)
{
return (int)((object)input);
}
public static T CastFromInt<T>(int input)
{
return (T)((object)input);
}
public static bool IsNullableInt<T>(T input)
{
return input is int?;
}
public static int? AsNullableInt<T>(T input)
{
return input as int?;
}
public static int? CastToNullableInt<T>(T input)
{
return (int?)((object)input);
}
public static T CastFromNullableInt<T>(int? input)
{
return (T)((object)input);
}
}

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

@ -36,7 +36,10 @@ using ICSharpCode.Decompiler.Metadata; @@ -36,7 +36,10 @@ using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CSharp;
using Microsoft.DiaSymReader.Tools;
using NUnit.Framework;
namespace ICSharpCode.Decompiler.Tests.Helpers
@ -180,10 +183,12 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -180,10 +183,12 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
static readonly Lazy<IEnumerable<MetadataReference>> defaultReferences = new Lazy<IEnumerable<MetadataReference>>(delegate {
string refAsmPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
@"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5");
@"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2");
string thisAsmPath = Path.GetDirectoryName(typeof(Tester).Assembly.Location);
return new[]
{
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "mscorlib.dll")),
MetadataReference.CreateFromFile(Path.Combine(thisAsmPath, "netstandard.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Core.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, @"Facades\System.Runtime.dll")),
@ -345,23 +350,39 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -345,23 +350,39 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
}
}
public static CSharpDecompiler GetDecompilerForSnippet(string csharpText)
public static void CompileCSharpWithPdb(string assemblyName, Dictionary<string, string> sourceFiles, PdbToXmlOptions options)
{
var syntaxTree = SyntaxFactory.ParseSyntaxTree(csharpText);
var compilation = CSharpCompilation.Create(
"TestAssembly",
new[] { syntaxTree },
defaultReferences.Value,
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
var peStream = new MemoryStream();
var emitResult = compilation.Emit(peStream);
peStream.Position = 0;
var moduleDefinition = new PEFile("TestAssembly.dll", peStream, PEStreamOptions.PrefetchEntireImage);
var resolver = new UniversalAssemblyResolver("TestAssembly.dll", false, moduleDefinition.Reader.DetectTargetFrameworkId(), PEStreamOptions.PrefetchEntireImage);
var decompiler = new CSharpDecompiler(moduleDefinition, resolver, new DecompilerSettings());
return decompiler;
var parseOptions = new CSharpParseOptions(languageVersion: Microsoft.CodeAnalysis.CSharp.LanguageVersion.Latest);
List<EmbeddedText> embeddedTexts = new List<EmbeddedText>();
List<SyntaxTree> syntaxTrees = new List<SyntaxTree>();
foreach (KeyValuePair<string, string> file in sourceFiles) {
var sourceText = SourceText.From(file.Value, new UTF8Encoding(false), SourceHashAlgorithm.Sha256);
syntaxTrees.Add(SyntaxFactory.ParseSyntaxTree(sourceText, parseOptions, file.Key));
embeddedTexts.Add(EmbeddedText.FromSource(file.Key, sourceText));
}
var compilation = CSharpCompilation.Create(Path.GetFileNameWithoutExtension(assemblyName),
syntaxTrees, defaultReferences.Value,
new CSharpCompilationOptions(
OutputKind.DynamicallyLinkedLibrary,
platform: Platform.AnyCpu,
optimizationLevel: OptimizationLevel.Release,
allowUnsafe: true,
deterministic: true
));
using (FileStream peStream = File.Open(assemblyName + ".dll", FileMode.OpenOrCreate, FileAccess.ReadWrite))
using (FileStream pdbStream = File.Open(assemblyName + ".pdb", FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
var emitResult = compilation.Emit(peStream, pdbStream, options: new EmitOptions(debugInformationFormat: DebugInformationFormat.PortablePdb, pdbFilePath: assemblyName + ".pdb"), embeddedTexts: embeddedTexts);
if (!emitResult.Success) {
StringBuilder b = new StringBuilder("Compiler error:");
foreach (var diag in emitResult.Diagnostics) {
b.AppendLine(diag.ToString());
}
throw new Exception(b.ToString());
}
}
}
internal static string GetSuffix(CompilerOptions cscOptions)

23
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
<PackageReference Include="DiffLib" Version="2017.7.26.1241" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="2.10.0" />
<PackageReference Include="Microsoft.DiaSymReader.Converter.Xml" Version="1.1.0-beta1-63314-01" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
@ -55,6 +56,7 @@ @@ -55,6 +56,7 @@
<ItemGroup>
<None Include="TestCases\Correctness\Jmp.il" />
<None Include="TestCases\Correctness\StackTests.il" />
<None Include="TestCases\Correctness\StackTypes.il" />
<None Include="TestCases\Correctness\Uninit.vb" />
<None Include="TestCases\ILPretty\FSharpLoops.fs" />
@ -69,6 +71,9 @@ @@ -69,6 +71,9 @@
<ItemGroup>
<Compile Include="DisassemblerPrettyTestRunner.cs" />
<Compile Include="TestCases\ILPretty\Issue1389.cs" />
<Compile Include="TestCases\Pretty\Discards.cs" />
<Compile Include="TestCases\Pretty\MultidimensionalArray.cs" />
<Compile Include="Output\CSharpAmbienceTests.cs" />
<Compile Include="Semantics\ConversionTests.cs" />
<Compile Include="Semantics\ExplicitConversionTest.cs" />
@ -78,7 +83,14 @@ @@ -78,7 +83,14 @@
<Compile Include="TestCases\Correctness\RefLocalsAndReturns.cs" />
<Compile Include="TestCases\ILPretty\Issue1256.cs" />
<Compile Include="TestCases\ILPretty\Issue1323.cs" />
<Compile Include="TestCases\Pretty\CustomAttributes2.cs" />
<Compile Include="TestCases\Pretty\EnumTests.cs" />
<Compile Include="TestCases\Pretty\TypeMemberTests.cs" />
<Compile Include="TestCases\Pretty\ValueTypes.cs" />
<None Include="TestCases\ILPretty\Issue1389.il" />
<None Include="TestCases\ILPretty\SequenceOfNestedIfs.cs" />
<Compile Include="TestCases\Pretty\ConstructorInitializers.cs" />
<None Include="TestCases\ILPretty\SequenceOfNestedIfs.il" />
<None Include="TestCases\Pretty\AsyncMain.cs" />
<None Include="TestCases\ILPretty\Issue1325.cs" />
<Compile Include="TestCases\Pretty\ConstantsTests.cs" />
@ -86,7 +98,7 @@ @@ -86,7 +98,7 @@
<Compile Include="TestCases\Pretty\OptionalArguments.cs" />
<Compile Include="TestCases\Pretty\CustomShortCircuitOperators.cs" />
<Compile Include="TestCases\Pretty\ReduceNesting.cs" />
<Compile Include="TestCases\Pretty\TypeTests.cs" />
<Compile Include="TestCases\Pretty\InterfaceTests.cs" />
<Compile Include="TestCases\Pretty\YieldReturn.cs" />
<None Include="TestCases\ILPretty\Issue1256.il" />
<None Include="TestCases\ILPretty\Issue1323.il" />
@ -126,7 +138,7 @@ @@ -126,7 +138,7 @@
<Compile Include="TestCases\Pretty\NullPropagation.cs" />
<Compile Include="TestCases\Pretty\VariableNaming.cs" />
<Compile Include="TestCases\Pretty\VariableNamingWithoutSymbols.cs" />
<Compile Include="Util\SequencePointTests.cs" />
<Compile Include="PdbGenerationTestRunner.cs" />
<None Include="TestCases\ILPretty\Issue1047.il" />
<None Include="TestCases\ILPretty\Issue959.cs" />
<None Include="TestCases\ILPretty\FSharpLoops_Debug.cs" />
@ -199,7 +211,12 @@ @@ -199,7 +211,12 @@
<Compile Include="TestCases\Pretty\AssemblyCustomAttributes.cs" />
<Compile Include="TestCases\Pretty\CustomAttributeSamples.cs" />
<Compile Include="TestCases\Pretty\CustomAttributes.cs" />
<Compile Include="CodeSampleFileParser.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="TestCases\PdbGen\ForLoopTests.xml" />
<Content Include="TestCases\PdbGen\HelloWorld.xml" />
<Content Include="TestCases\PdbGen\LambdaCapturing.xml" />
</ItemGroup>
<ItemGroup>

51
ICSharpCode.Decompiler.Tests/IL/ILTests.cs

@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.IO;
using ICSharpCode.Decompiler.Ast;
using ICSharpCode.Decompiler.Tests.Helpers;
using Mono.Cecil;
using NUnit.Framework;
namespace ICSharpCode.Decompiler.Tests
{
[TestFixture]
public class ILTests
{
const string path = "../../Tests/IL";
[Test]
public void SequenceOfNestedIfs()
{
Run("SequenceOfNestedIfs.dll", "SequenceOfNestedIfs.Output.cs");
}
void Run(string compiledFile, string expectedOutputFile)
{
string expectedOutput = File.ReadAllText(Path.Combine(path, expectedOutputFile));
var assembly = AssemblyDefinition.ReadAssembly(Path.Combine(path, compiledFile));
AstBuilder decompiler = new AstBuilder(new DecompilerContext(assembly.MainModule));
decompiler.AddAssembly(assembly);
new Helpers.RemoveCompilerAttribute().Run(decompiler.SyntaxTree);
StringWriter output = new StringWriter();
decompiler.GenerateCode(new PlainTextOutput(output));
CodeAssert.AreEqual(expectedOutput, output.ToString());
}
}
}

BIN
ICSharpCode.Decompiler.Tests/IL/SequenceOfNestedIfs.dll

Binary file not shown.

BIN
ICSharpCode.Decompiler.Tests/IL/StackTests.exe

Binary file not shown.

12
ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs

@ -82,6 +82,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -82,6 +82,12 @@ namespace ICSharpCode.Decompiler.Tests
Run();
}
[Test]
public void Issue1389()
{
Run();
}
[Test]
public void FSharpUsing_Debug()
{
@ -136,6 +142,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -136,6 +142,12 @@ namespace ICSharpCode.Decompiler.Tests
Run();
}
[Test]
public void SequenceOfNestedIfs()
{
Run();
}
[Test]
public void FSharpLoops_Debug()
{

254
ICSharpCode.Decompiler.Tests/IncrementDecrement.cs

@ -1,254 +0,0 @@ @@ -1,254 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
public class IncrementDecrement
{
[Flags]
private enum MyEnum
{
None = 0,
One = 1,
Two = 2,
Four = 4
}
public class MutableClass
{
public int Field;
public int Property
{
get;
set;
}
public uint this[string name]
{
get
{
return 0u;
}
set
{
}
}
}
private IncrementDecrement.MyEnum enumField;
public static int StaticField;
public static int StaticProperty
{
get;
set;
}
private IncrementDecrement.MutableClass M()
{
return new IncrementDecrement.MutableClass();
}
private int[,] Array()
{
return null;
}
private unsafe int* GetPointer()
{
return null;
}
public int PreIncrementInAddition(int i, int j)
{
return i + ++j;
}
public int PreIncrementArrayElement(int[] array, int pos)
{
return --array[pos];
}
public int PreIncrementInstanceField()
{
return ++this.M().Field;
}
public int PreIncrementInstanceField2(IncrementDecrement.MutableClass m)
{
return ++m.Field;
}
public int PreIncrementInstanceProperty()
{
return ++this.M().Property;
}
public int PreIncrementStaticField()
{
return ++IncrementDecrement.StaticField;
}
public int PreIncrementStaticProperty()
{
return ++IncrementDecrement.StaticProperty;
}
// public uint PreIncrementIndexer(string name)
// {
// return ++this.M()[name];
// }
public int PreIncrementByRef(ref int i)
{
return ++i;
}
public unsafe int PreIncrementByPointer()
{
return ++(*this.GetPointer());
}
public int PreIncrement2DArray()
{
return ++this.Array()[1, 2];
}
public int CompoundAssignInstanceField()
{
return this.M().Field *= 10;
}
public int CompoundAssignInstanceProperty()
{
return this.M().Property *= 10;
}
public int CompoundAssignStaticField()
{
return IncrementDecrement.StaticField ^= 100;
}
public int CompoundAssignStaticProperty()
{
return IncrementDecrement.StaticProperty &= 10;
}
public int CompoundAssignArrayElement1(int[] array, int pos)
{
return array[pos] *= 10;
}
public int CompoundAssignArrayElement2(int[] array)
{
return array[Environment.TickCount] *= 10;
}
// public uint CompoundAssignIndexer(string name)
// {
// return this.M()[name] -= 2;
// }
public int CompoundAssignIncrement2DArray()
{
return this.Array()[1, 2] %= 10;
}
public int CompoundAssignByRef(ref int i)
{
return i <<= 2;
}
public unsafe double CompoundAssignByPointer(double* ptr)
{
return *ptr /= 1.5;
}
public void CompoundAssignEnum()
{
this.enumField |= IncrementDecrement.MyEnum.Two;
this.enumField &= ~IncrementDecrement.MyEnum.Four;
}
public int PostIncrementInAddition(int i, int j)
{
return i++ + j;
}
public void PostIncrementInlineLocalVariable(Func<int, int> f)
{
int num = 0;
f(num++);
}
public int PostIncrementArrayElement(int[] array, int pos)
{
return array[pos]--;
}
public int PostIncrementStaticField()
{
return IncrementDecrement.StaticField++;
}
public int PostIncrementStaticProperty()
{
return IncrementDecrement.StaticProperty++;
}
public int PostIncrementInstanceField(IncrementDecrement.MutableClass m)
{
return m.Field++;
}
// public uint PostIncrementIndexer(string name)
// {
// return this.M()[name]++;
// }
// public unsafe int PostIncrementOfPointer(int* ptr)
// {
// return *(ptr++);
// }
public int PostIncrementInstanceField()
{
return this.M().Field--;
}
public int PostIncrementInstanceProperty()
{
return this.M().Property--;
}
public int PostIncrement2DArray()
{
return this.Array()[IncrementDecrement.StaticField, IncrementDecrement.StaticProperty]++;
}
public int PostIncrementByRef(ref int i)
{
return i++;
}
public unsafe int PostIncrementByPointer()
{
return (*this.GetPointer())++;
}
}

111
ICSharpCode.Decompiler.Tests/PdbGenerationTestRunner.cs

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Runtime.CompilerServices;
using System.Text;
using System.Xml.Linq;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.CSharp.OutputVisitor;
using ICSharpCode.Decompiler.DebugInfo;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.Tests.Helpers;
using ICSharpCode.Decompiler.TypeSystem;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.DiaSymReader.Tools;
using NUnit.Framework;
namespace ICSharpCode.Decompiler.Tests
{
[TestFixture]
public class PdbGenerationTestRunner
{
static readonly string TestCasePath = Tester.TestCasePath + "/PdbGen";
[Test]
public void HelloWorld()
{
TestGeneratePdb();
}
[Test]
[Ignore("Missing nested local scopes for loops, differences in IL ranges")]
public void ForLoopTests()
{
TestGeneratePdb();
}
[Test]
[Ignore("Differences in IL ranges")]
public void LambdaCapturing()
{
TestGeneratePdb();
}
private void TestGeneratePdb([CallerMemberName] string testName = null)
{
const PdbToXmlOptions options = PdbToXmlOptions.IncludeEmbeddedSources | PdbToXmlOptions.ThrowOnError | PdbToXmlOptions.IncludeTokens | PdbToXmlOptions.ResolveTokens | PdbToXmlOptions.IncludeMethodSpans;
string xmlFile = Path.Combine(TestCasePath, testName + ".xml");
string xmlContent = File.ReadAllText(xmlFile);
XDocument document = XDocument.Parse(xmlContent);
var files = document.Descendants("file").ToDictionary(f => f.Attribute("name").Value, f => f.Value);
Tester.CompileCSharpWithPdb(Path.Combine(TestCasePath, testName + ".expected"), files, options);
string peFileName = Path.Combine(TestCasePath, testName + ".expected.dll");
string pdbFileName = Path.Combine(TestCasePath, testName + ".expected.pdb");
var moduleDefinition = new PEFile(peFileName);
var resolver = new UniversalAssemblyResolver(peFileName, false, moduleDefinition.Reader.DetectTargetFrameworkId(), PEStreamOptions.PrefetchEntireImage);
var decompiler = new CSharpDecompiler(moduleDefinition, resolver, new DecompilerSettings());
using (FileStream pdbStream = File.Open(Path.Combine(TestCasePath, testName + ".pdb"), FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
pdbStream.SetLength(0);
PortablePdbWriter.WritePdb(moduleDefinition, decompiler, new DecompilerSettings(), pdbStream, noLogo: true);
pdbStream.Position = 0;
using (Stream peStream = File.OpenRead(peFileName))
using (Stream expectedPdbStream = File.OpenRead(pdbFileName)) {
using (StreamWriter writer = new StreamWriter(Path.ChangeExtension(pdbFileName, ".xml"), false, Encoding.UTF8)) {
PdbToXmlConverter.ToXml(writer, expectedPdbStream, peStream, options);
}
peStream.Position = 0;
using (StreamWriter writer = new StreamWriter(Path.ChangeExtension(xmlFile, ".generated.xml"), false, Encoding.UTF8)) {
PdbToXmlConverter.ToXml(writer, pdbStream, peStream, options);
}
}
}
string expectedFileName = Path.ChangeExtension(xmlFile, ".expected.xml");
ProcessXmlFile(expectedFileName);
string generatedFileName = Path.ChangeExtension(xmlFile, ".generated.xml");
ProcessXmlFile(generatedFileName);
Assert.AreEqual(Normalize(expectedFileName), Normalize(generatedFileName));
}
private void ProcessXmlFile(string fileName)
{
var document = XDocument.Load(fileName);
foreach (var file in document.Descendants("file")) {
file.Attribute("checksum").Remove();
file.Attribute("embeddedSourceLength").Remove();
file.ReplaceNodes(new XCData(file.Value.Replace("\uFEFF", "")));
}
document.Save(fileName, SaveOptions.None);
}
private string Normalize(string inputFileName)
{
return File.ReadAllText(inputFileName).Replace("\r\n", "\n").Replace("\r", "\n");
}
}
class StringWriterWithEncoding : StringWriter
{
readonly Encoding encoding;
public StringWriterWithEncoding(Encoding encoding)
{
this.encoding = encoding ?? throw new ArgumentNullException("encoding");
}
public override Encoding Encoding => encoding;
}
}

39
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -257,6 +257,13 @@ namespace ICSharpCode.Decompiler.Tests @@ -257,6 +257,13 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions);
}
[Test]
[Ignore("Special cases not implemented in new decompiler.")]
public void ValueTypes([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void VariableNaming([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
@ -359,6 +366,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -359,6 +366,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void CustomAttributes2([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void CustomAttributeConflicts([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
@ -378,7 +391,25 @@ namespace ICSharpCode.Decompiler.Tests @@ -378,7 +391,25 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
public void TypeTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
public void MultidimensionalArray([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void EnumTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void InterfaceTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void TypeMemberTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
@ -389,6 +420,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -389,6 +420,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Discards([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
void RunForLibrary([CallerMemberName] string testName = null, AssemblerOptions asmOptions = AssemblerOptions.None, CompilerOptions cscOptions = CompilerOptions.None, DecompilerSettings decompilerSettings = null)
{
Run(testName, asmOptions | AssemblerOptions.Library, cscOptions | CompilerOptions.Library, decompilerSettings);

18
ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs

@ -259,5 +259,23 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -259,5 +259,23 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
return num;
}
static void Issue1392ForWithNestedSwitchPlusGoto()
{
for (int i = 0; i < 100; i++) {
again:
switch (i) {
case 10:
Console.WriteLine("10");
break;
case 25:
Console.WriteLine("25");
break;
case 50:
Console.WriteLine("50");
goto again;
}
}
}
}
}

0
ICSharpCode.Decompiler.Tests/IL/StackTests.il → ICSharpCode.Decompiler.Tests/TestCases/Correctness/StackTests.il

28
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
// Issue1389.Program
using System;
namespace Issue1389
{
public class Program
{
private static object GetObject()
{
throw null;
}
private static void UnusedResultOfIsinst()
{
bool flag = GetObject() is TypeCode;
}
private static bool BoolResultOfIsinst()
{
return GetObject() is TypeCode;
}
private static object EnumResultOfIsinst(object A_0)
{
return (A_0 is TypeCode) ? A_0 : null;
}
}
}

74
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.il

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 4:0:0:0
}
.assembly Issue1389
{
.hash algorithm 0x00008004
.ver 1:0:4059:39717
}
.module Issue1389.dll
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000003 // ILONLY 32BITREQUIRED
.class public auto ansi beforefieldinit Issue1389.Program
extends [mscorlib]System.Object
{
// Methods
.method /* 06000001 */ private hidebysig static
object GetObject () cil managed
{
// Method begins at RVA 0x2050
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldnull
IL_0001: throw
} // end of method Program::GetObject
.method /* 06000002 */ private hidebysig static
void UnusedResultOfIsinst () cil managed
{
// Method begins at RVA 0x2053
// Code size 12 (0xc)
.maxstack 8
IL_0000: call object Issue1389.Program::GetObject() /* 06000001 */
IL_0005: isinst [mscorlib]System.TypeCode /* 01000002 */
IL_000a: pop
IL_000b: ret
} // end of method Program::UnusedResultOfIsinst
.method /* 06000003 */ private hidebysig static
bool BoolResultOfIsinst () cil managed
{
// Method begins at RVA 0x2060
// Code size 14 (0xe)
.maxstack 8
IL_0000: call object Issue1389.Program::GetObject() /* 06000001 */
IL_0005: isinst [mscorlib]System.TypeCode /* 01000002 */
IL_000a: ldnull
IL_000b: cgt.un
IL_000d: ret
} // end of method Program::BoolResultOfIsinst
.method /* 06000004 */ private hidebysig static
object EnumResultOfIsinst (
object A_0
) cil managed
{
// Method begins at RVA 0x206f
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: isinst [mscorlib]System.TypeCode /* 01000002 */
IL_0006: ret
} // end of method Program::EnumResultOfIsinst
} // end of class Issue1389.Program

32
ICSharpCode.Decompiler.Tests/IL/SequenceOfNestedIfs.Output.cs → ICSharpCode.Decompiler.Tests/TestCases/ILPretty/SequenceOfNestedIfs.cs

@ -18,36 +18,26 @@ public class SequenceOfNestedIfs @@ -18,36 +18,26 @@ public class SequenceOfNestedIfs
}
public override void CreateMaterials()
{
if (!this._clear)
{
if (!this.CheckShader())
{
if (!_clear) {
if (!CheckShader()) {
return;
}
this._material = new Material();
_material = new Material();
}
if (!this._material)
{
if (!this.CheckShader())
{
if (!_material) {
if (!CheckShader()) {
return;
}
this._material = new Material();
_material = new Material();
}
if (!this._material)
{
if (!this.CheckShader())
{
if (!_material) {
if (!CheckShader()) {
return;
}
this._material = new Material();
_material = new Material();
}
if (!this._material)
{
if (this.CheckShader())
{
this._material = new Material();
}
if (!_material && CheckShader()) {
_material = new Material();
}
}
}

0
ICSharpCode.Decompiler.Tests/IL/SequenceOfNestedIfs.il → ICSharpCode.Decompiler.Tests/TestCases/ILPretty/SequenceOfNestedIfs.il

4
ICSharpCode.Decompiler.Tests/TestCases/PdbGen/.gitignore vendored

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
/*.dll
/*.pdb
/*.expected.xml
/*.generated.xml

73
ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<symbols>
<files>
<file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\ForLoopTests.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen
{
public class ForLoopTests
{
public static void SimplePrintLoop(string[] args)
{
for (int i = 0; i < args.Length; i++)
{
Console.WriteLine(args[i]);
}
}
public static void SimplePrintLoopWithCondition(string[] args)
{
for (int i = 0; i < args.Length; i++)
{
if (i % 2 != 0)
{
Console.WriteLine(args[i]);
}
}
}
}
}
]]></file>
</files>
<methods>
<method containingType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.ForLoopTests" name="SimplePrintLoop" parameterNames="args" token="0x6000001">
<sequencePoints>
<entry offset="0x0" startLine="9" startColumn="9" endLine="9" endColumn="18" document="1" />
<entry offset="0x2" hidden="true" document="1" />
<entry offset="0x4" startLine="11" startColumn="5" endLine="11" endColumn="32" document="1" />
<entry offset="0xc" startLine="9" startColumn="37" endLine="9" endColumn="40" document="1" />
<entry offset="0x10" startLine="9" startColumn="20" endLine="9" endColumn="35" document="1" />
<entry offset="0x16" startLine="13" startColumn="3" endLine="13" endColumn="4" document="1" />
</sequencePoints>
<scope startOffset="0x0" endOffset="0x17">
<scope startOffset="0x0" endOffset="0x16">
<local name="i" il_index="0" il_start="0x0" il_end="0x16" attributes="0" />
</scope>
</scope>
</method>
<method containingType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.ForLoopTests" name="SimplePrintLoopWithCondition" parameterNames="args" token="0x6000002">
<sequencePoints>
<entry offset="0x0" startLine="17" startColumn="9" endLine="17" endColumn="18" document="1" />
<entry offset="0x2" hidden="true" document="1" />
<entry offset="0x4" startLine="19" startColumn="5" endLine="19" endColumn="20" document="1" />
<entry offset="0x9" startLine="21" startColumn="6" endLine="21" endColumn="33" document="1" />
<entry offset="0x11" startLine="17" startColumn="37" endLine="17" endColumn="40" document="1" />
<entry offset="0x15" startLine="17" startColumn="20" endLine="17" endColumn="35" document="1" />
<entry offset="0x1b" startLine="24" startColumn="3" endLine="24" endColumn="4" document="1" />
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1c">
<scope startOffset="0x0" endOffset="0x1b">
<local name="i" il_index="0" il_start="0x0" il_end="0x1b" attributes="0" />
</scope>
</scope>
</method>
</methods>
<method-spans>
<method declaringType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.ForLoopTests" methodName="SimplePrintLoop" parameterNames="args" token="0x6000001">
<document startLine="9" endLine="13" />
</method>
<method declaringType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.ForLoopTests" methodName="SimplePrintLoopWithCondition" parameterNames="args" token="0x6000002">
<document startLine="17" endLine="24" />
</method>
</method-spans>
</symbols>

36
ICSharpCode.Decompiler.Tests/TestCases/PdbGen/HelloWorld.xml

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<symbols>
<files>
<file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\HelloWorld.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen
{
public class HelloWorld
{
public static void Main(string[] args)
{
Console.ReadKey();
Console.WriteLine("Hello World!");
Console.ReadKey();
}
}
}
]]></file>
</files>
<methods>
<method containingType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.HelloWorld" name="Main" parameterNames="args" token="0x6000001">
<sequencePoints>
<entry offset="0x0" startLine="9" startColumn="4" endLine="9" endColumn="22" document="1" />
<entry offset="0x6" startLine="10" startColumn="4" endLine="10" endColumn="38" document="1" />
<entry offset="0x10" startLine="11" startColumn="4" endLine="11" endColumn="22" document="1" />
<entry offset="0x16" startLine="12" startColumn="3" endLine="12" endColumn="4" document="1" />
</sequencePoints>
<scope startOffset="0x0" endOffset="0x17" />
</method>
</methods>
<method-spans>
<method declaringType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.HelloWorld" methodName="Main" parameterNames="args" token="0x6000001">
<document startLine="9" endLine="12" />
</method>
</method-spans>
</symbols>

63
ICSharpCode.Decompiler.Tests/TestCases/PdbGen/LambdaCapturing.xml

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<symbols>
<files>
<file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\LambdaCapturing.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen
{
public class LambdaCapturing
{
public static void Main(string[] args)
{
int num = 4;
int captured = Environment.TickCount + num;
Test((int a, int b) => a + b + captured);
}
private static void Test(Func<int, int, int> p)
{
p(1, 2);
}
}
}
]]></file>
</files>
<methods>
<method containingType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.LambdaCapturing" name="Main" parameterNames="args" token="0x6000001">
<sequencePoints>
<entry offset="0x0" hidden="true" document="1" />
<entry offset="0x5" startLine="9" startColumn="13" endLine="9" endColumn="27" document="1" />
<entry offset="0x7" startLine="10" startColumn="13" endLine="10" endColumn="58" document="1" />
<entry offset="0x14" startLine="11" startColumn="13" endLine="11" endColumn="46" document="1" />
<entry offset="0x24" startLine="12" startColumn="9" endLine="12" endColumn="10" document="1" />
</sequencePoints>
<scope startOffset="0x0" endOffset="0x25">
<local name="local" il_index="0" il_start="0x0" il_end="0x25" attributes="0" />
</scope>
</method>
<method containingType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.LambdaCapturing" name="Test" parameterNames="p" token="0x6000002">
<sequencePoints>
<entry offset="0x0" startLine="16" startColumn="13" endLine="16" endColumn="21" document="1" />
<entry offset="0x9" startLine="17" startColumn="9" endLine="17" endColumn="10" document="1" />
</sequencePoints>
<scope startOffset="0x0" endOffset="0xa" />
</method>
<method containingType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.LambdaCapturing+&lt;&gt;c__DisplayClass0_0" name="&lt;Main&gt;b__0" parameterNames="a, b" token="0x6000005">
<sequencePoints>
<entry offset="0x0" startLine="11" startColumn="28" endLine="11" endColumn="44" document="1" />
</sequencePoints>
<scope startOffset="0x0" endOffset="0xb" />
</method>
</methods>
<method-spans>
<method declaringType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.LambdaCapturing" methodName="Main" parameterNames="args" token="0x6000001">
<document startLine="9" endLine="12" />
</method>
<method declaringType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.LambdaCapturing" methodName="Test" parameterNames="p" token="0x6000002">
<document startLine="16" endLine="17" />
</method>
<method declaringType="ICSharpCode.Decompiler.Tests.TestCases.PdbGen.LambdaCapturing+&lt;&gt;c__DisplayClass0_0" methodName="&lt;Main&gt;b__0" parameterNames="a, b" token="0x6000005">
<document startLine="11" endLine="11" />
</method>
</method-spans>
</symbols>

128
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs

@ -4576,5 +4576,133 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -4576,5 +4576,133 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
new CustomClass().StringProp += "a";
new CustomClass().StringProp += 1;
}
#if false
public uint PreIncrementIndexer(string name)
{
return ++M()[name];
}
#endif
public int PreIncrementByRef(ref int i)
{
return ++i;
}
public unsafe int PreIncrementByPointer()
{
return ++(*GetPointer());
}
public int PreIncrement2DArray()
{
return ++Array()[1, 2];
}
public int CompoundAssignInstanceField()
{
return M().Field *= 10;
}
public int CompoundAssignInstanceProperty()
{
return M().Property *= 10;
}
public int CompoundAssignStaticField()
{
return StaticField ^= 100;
}
public int CompoundAssignStaticProperty()
{
return StaticProperty &= 10;
}
public int CompoundAssignArrayElement1(int[] array, int pos)
{
return array[pos] *= 10;
}
public int CompoundAssignArrayElement2(int[] array)
{
return array[Environment.TickCount] *= 10;
}
#if false
public uint CompoundAssignIndexer(string name)
{
return M()[name] -= 2;
}
#endif
public int CompoundAssignIncrement2DArray()
{
return Array()[1, 2] %= 10;
}
public int CompoundAssignByRef(ref int i)
{
return i <<= 2;
}
public unsafe double CompoundAssignByPointer(double* ptr)
{
return *ptr /= 1.5;
}
public void CompoundAssignEnum()
{
enumField |= MyEnum.Two;
enumField &= ~MyEnum.Four;
}
public int PostIncrementInAddition(int i, int j)
{
return i++ + j;
}
public void PostIncrementInlineLocalVariable(Func<int, int> f)
{
int num = 0;
f(num++);
}
public int PostDecrementArrayElement(int[] array, int pos)
{
return array[pos]--;
}
#if false
public uint PostIncrementIndexer(string name)
{
return M()[name]++;
}
public unsafe int PostIncrementOfPointer(int* ptr)
{
return *(ptr++);
}
#endif
public int PostDecrementInstanceField()
{
return M().Field--;
}
public int PostDecrementInstanceProperty()
{
return M().Property--;
}
public int PostIncrement2DArray()
{
return Array()[StaticField, StaticProperty]++;
}
public int PostIncrementByRef(ref int i)
{
return i++;
}
public unsafe int PostIncrementByPointer()
{
return (*GetPointer())++;
}
}
}

517
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.il

@ -21596,6 +21596,523 @@ @@ -21596,6 +21596,523 @@
IL_0063: ret
} // end of method CompoundAssignmentTest::StringPropertyCompoundAssign
.method public hidebysig instance int32
PreIncrementByRef(int32& i) cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: dup
IL_0003: ldind.i4
IL_0004: ldc.i4.1
IL_0005: add
IL_0006: dup
IL_0007: stloc.1
IL_0008: stind.i4
IL_0009: ldloc.1
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method CompoundAssignmentTest::PreIncrementByRef
.method public hidebysig instance int32
PreIncrementByPointer() cil managed
{
// Code size 20 (0x14)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0007: dup
IL_0008: ldind.i4
IL_0009: ldc.i4.1
IL_000a: add
IL_000b: dup
IL_000c: stloc.1
IL_000d: stind.i4
IL_000e: ldloc.1
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::PreIncrementByPointer
.method public hidebysig instance int32
PreIncrement2DArray() cil managed
{
// Code size 35 (0x23)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0007: ldc.i4.1
IL_0008: ldc.i4.2
IL_0009: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000e: dup
IL_000f: ldobj [mscorlib]System.Int32
IL_0014: ldc.i4.1
IL_0015: add
IL_0016: dup
IL_0017: stloc.1
IL_0018: stobj [mscorlib]System.Int32
IL_001d: ldloc.1
IL_001e: stloc.0
IL_001f: br.s IL_0021
IL_0021: ldloc.0
IL_0022: ret
} // end of method CompoundAssignmentTest::PreIncrement2DArray
.method public hidebysig instance int32
CompoundAssignInstanceField() cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: ldc.i4.s 10
IL_000f: mul
IL_0010: dup
IL_0011: stloc.1
IL_0012: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0017: ldloc.1
IL_0018: stloc.0
IL_0019: br.s IL_001b
IL_001b: ldloc.0
IL_001c: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceField
.method public hidebysig instance int32
CompoundAssignInstanceProperty() cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: ldc.i4.s 10
IL_000f: mul
IL_0010: dup
IL_0011: stloc.1
IL_0012: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0017: nop
IL_0018: ldloc.1
IL_0019: stloc.0
IL_001a: br.s IL_001c
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceProperty
.method public hidebysig instance int32
CompoundAssignStaticField() cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0006: ldc.i4.s 100
IL_0008: xor
IL_0009: dup
IL_000a: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticField
.method public hidebysig instance int32
CompoundAssignStaticProperty() cil managed
{
// Code size 21 (0x15)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0006: ldc.i4.s 10
IL_0008: and
IL_0009: dup
IL_000a: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000f: nop
IL_0010: stloc.0
IL_0011: br.s IL_0013
IL_0013: ldloc.0
IL_0014: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticProperty
.method public hidebysig instance int32
CompoundAssignArrayElement1(int32[] 'array',
int32 pos) cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldobj [mscorlib]System.Int32
IL_000e: ldc.i4.s 10
IL_0010: mul
IL_0011: dup
IL_0012: stloc.1
IL_0013: stobj [mscorlib]System.Int32
IL_0018: ldloc.1
IL_0019: stloc.0
IL_001a: br.s IL_001c
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement1
.method public hidebysig instance int32
CompoundAssignArrayElement2(int32[] 'array') cil managed
{
// Code size 34 (0x22)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: call int32 [mscorlib]System.Environment::get_TickCount()
IL_0007: ldelema [mscorlib]System.Int32
IL_000c: dup
IL_000d: ldobj [mscorlib]System.Int32
IL_0012: ldc.i4.s 10
IL_0014: mul
IL_0015: dup
IL_0016: stloc.1
IL_0017: stobj [mscorlib]System.Int32
IL_001c: ldloc.1
IL_001d: stloc.0
IL_001e: br.s IL_0020
IL_0020: ldloc.0
IL_0021: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement2
.method public hidebysig instance int32
CompoundAssignIncrement2DArray() cil managed
{
// Code size 36 (0x24)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0007: ldc.i4.1
IL_0008: ldc.i4.2
IL_0009: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000e: dup
IL_000f: ldobj [mscorlib]System.Int32
IL_0014: ldc.i4.s 10
IL_0016: rem
IL_0017: dup
IL_0018: stloc.1
IL_0019: stobj [mscorlib]System.Int32
IL_001e: ldloc.1
IL_001f: stloc.0
IL_0020: br.s IL_0022
IL_0022: ldloc.0
IL_0023: ret
} // end of method CompoundAssignmentTest::CompoundAssignIncrement2DArray
.method public hidebysig instance int32
CompoundAssignByRef(int32& i) cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: dup
IL_0003: ldind.i4
IL_0004: ldc.i4.2
IL_0005: shl
IL_0006: dup
IL_0007: stloc.1
IL_0008: stind.i4
IL_0009: ldloc.1
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method CompoundAssignmentTest::CompoundAssignByRef
.method public hidebysig instance float64
CompoundAssignByPointer(float64* ptr) cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (float64 V_0,
float64 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: dup
IL_0003: ldind.r8
IL_0004: ldc.r8 1.5
IL_000d: div
IL_000e: dup
IL_000f: stloc.1
IL_0010: stind.r8
IL_0011: ldloc.1
IL_0012: stloc.0
IL_0013: br.s IL_0015
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::CompoundAssignByPointer
.method public hidebysig instance void
CompoundAssignEnum() cil managed
{
// Code size 31 (0x1f)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: dup
IL_0003: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0008: ldc.i4.2
IL_0009: or
IL_000a: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000f: ldarg.0
IL_0010: dup
IL_0011: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0016: ldc.i4.s -5
IL_0018: and
IL_0019: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001e: ret
} // end of method CompoundAssignmentTest::CompoundAssignEnum
.method public hidebysig instance int32
PostIncrementInAddition(int32 i,
int32 j) cil managed
{
// Code size 14 (0xe)
.maxstack 3
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: dup
IL_0003: ldc.i4.1
IL_0004: add
IL_0005: starg.s i
IL_0007: ldarg.2
IL_0008: add
IL_0009: stloc.0
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ret
} // end of method CompoundAssignmentTest::PostIncrementInAddition
.method public hidebysig instance void
PostIncrementInlineLocalVariable(class [mscorlib]System.Func`2<int32,int32> f) cil managed
{
// Code size 16 (0x10)
.maxstack 4
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldc.i4.0
IL_0002: stloc.0
IL_0003: ldarg.1
IL_0004: ldloc.0
IL_0005: dup
IL_0006: ldc.i4.1
IL_0007: add
IL_0008: stloc.0
IL_0009: callvirt instance !1 class [mscorlib]System.Func`2<int32,int32>::Invoke(!0)
IL_000e: pop
IL_000f: ret
} // end of method CompoundAssignmentTest::PostIncrementInlineLocalVariable
.method public hidebysig instance int32
PostDecrementArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldobj [mscorlib]System.Int32
IL_000e: dup
IL_000f: stloc.1
IL_0010: ldc.i4.1
IL_0011: sub
IL_0012: stobj [mscorlib]System.Int32
IL_0017: ldloc.1
IL_0018: stloc.0
IL_0019: br.s IL_001b
IL_001b: ldloc.0
IL_001c: ret
} // end of method CompoundAssignmentTest::PostDecrementArrayElement
.method public hidebysig instance int32
PostDecrementInstanceField() cil managed
{
// Code size 28 (0x1c)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: dup
IL_000e: stloc.1
IL_000f: ldc.i4.1
IL_0010: sub
IL_0011: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0016: ldloc.1
IL_0017: stloc.0
IL_0018: br.s IL_001a
IL_001a: ldloc.0
IL_001b: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceField
.method public hidebysig instance int32
PostDecrementInstanceProperty() cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: dup
IL_000e: stloc.1
IL_000f: ldc.i4.1
IL_0010: sub
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0016: nop
IL_0017: ldloc.1
IL_0018: stloc.0
IL_0019: br.s IL_001b
IL_001b: ldloc.0
IL_001c: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceProperty
.method public hidebysig instance int32
PostIncrement2DArray() cil managed
{
// Code size 43 (0x2b)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0007: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000c: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0011: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_0016: dup
IL_0017: ldobj [mscorlib]System.Int32
IL_001c: dup
IL_001d: stloc.1
IL_001e: ldc.i4.1
IL_001f: add
IL_0020: stobj [mscorlib]System.Int32
IL_0025: ldloc.1
IL_0026: stloc.0
IL_0027: br.s IL_0029
IL_0029: ldloc.0
IL_002a: ret
} // end of method CompoundAssignmentTest::PostIncrement2DArray
.method public hidebysig instance int32
PostIncrementByRef(int32& i) cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: dup
IL_0003: ldind.i4
IL_0004: dup
IL_0005: stloc.1
IL_0006: ldc.i4.1
IL_0007: add
IL_0008: stind.i4
IL_0009: ldloc.1
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method CompoundAssignmentTest::PostIncrementByRef
.method public hidebysig instance int32
PostIncrementByPointer() cil managed
{
// Code size 20 (0x14)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0007: dup
IL_0008: ldind.i4
IL_0009: dup
IL_000a: stloc.1
IL_000b: ldc.i4.1
IL_000c: add
IL_000d: stind.i4
IL_000e: ldloc.1
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::PostIncrementByPointer
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

398
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il

@ -19873,6 +19873,404 @@ @@ -19873,6 +19873,404 @@
IL_005e: ret
} // end of method CompoundAssignmentTest::StringPropertyCompoundAssign
.method public hidebysig instance int32
PreIncrementByRef(int32& i) cil managed
{
// Code size 10 (0xa)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: dup
IL_0002: ldind.i4
IL_0003: ldc.i4.1
IL_0004: add
IL_0005: dup
IL_0006: stloc.0
IL_0007: stind.i4
IL_0008: ldloc.0
IL_0009: ret
} // end of method CompoundAssignmentTest::PreIncrementByRef
.method public hidebysig instance int32
PreIncrementByPointer() cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0006: dup
IL_0007: ldind.i4
IL_0008: ldc.i4.1
IL_0009: add
IL_000a: dup
IL_000b: stloc.0
IL_000c: stind.i4
IL_000d: ldloc.0
IL_000e: ret
} // end of method CompoundAssignmentTest::PreIncrementByPointer
.method public hidebysig instance int32
PreIncrement2DArray() cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0006: ldc.i4.1
IL_0007: ldc.i4.2
IL_0008: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000d: dup
IL_000e: ldobj [mscorlib]System.Int32
IL_0013: ldc.i4.1
IL_0014: add
IL_0015: dup
IL_0016: stloc.0
IL_0017: stobj [mscorlib]System.Int32
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::PreIncrement2DArray
.method public hidebysig instance int32
CompoundAssignInstanceField() cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: ldc.i4.s 10
IL_000e: mul
IL_000f: dup
IL_0010: stloc.0
IL_0011: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceField
.method public hidebysig instance int32
CompoundAssignInstanceProperty() cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: ldc.i4.s 10
IL_000e: mul
IL_000f: dup
IL_0010: stloc.0
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceProperty
.method public hidebysig instance int32
CompoundAssignStaticField() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0005: ldc.i4.s 100
IL_0007: xor
IL_0008: dup
IL_0009: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000e: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticField
.method public hidebysig instance int32
CompoundAssignStaticProperty() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0005: ldc.i4.s 10
IL_0007: and
IL_0008: dup
IL_0009: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000e: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticProperty
.method public hidebysig instance int32
CompoundAssignArrayElement1(int32[] 'array',
int32 pos) cil managed
{
// Code size 25 (0x19)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldobj [mscorlib]System.Int32
IL_000d: ldc.i4.s 10
IL_000f: mul
IL_0010: dup
IL_0011: stloc.0
IL_0012: stobj [mscorlib]System.Int32
IL_0017: ldloc.0
IL_0018: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement1
.method public hidebysig instance int32
CompoundAssignArrayElement2(int32[] 'array') cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: call int32 [mscorlib]System.Environment::get_TickCount()
IL_0006: ldelema [mscorlib]System.Int32
IL_000b: dup
IL_000c: ldobj [mscorlib]System.Int32
IL_0011: ldc.i4.s 10
IL_0013: mul
IL_0014: dup
IL_0015: stloc.0
IL_0016: stobj [mscorlib]System.Int32
IL_001b: ldloc.0
IL_001c: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement2
.method public hidebysig instance int32
CompoundAssignIncrement2DArray() cil managed
{
// Code size 31 (0x1f)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0006: ldc.i4.1
IL_0007: ldc.i4.2
IL_0008: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000d: dup
IL_000e: ldobj [mscorlib]System.Int32
IL_0013: ldc.i4.s 10
IL_0015: rem
IL_0016: dup
IL_0017: stloc.0
IL_0018: stobj [mscorlib]System.Int32
IL_001d: ldloc.0
IL_001e: ret
} // end of method CompoundAssignmentTest::CompoundAssignIncrement2DArray
.method public hidebysig instance int32
CompoundAssignByRef(int32& i) cil managed
{
// Code size 10 (0xa)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: dup
IL_0002: ldind.i4
IL_0003: ldc.i4.2
IL_0004: shl
IL_0005: dup
IL_0006: stloc.0
IL_0007: stind.i4
IL_0008: ldloc.0
IL_0009: ret
} // end of method CompoundAssignmentTest::CompoundAssignByRef
.method public hidebysig instance float64
CompoundAssignByPointer(float64* ptr) cil managed
{
// Code size 18 (0x12)
.maxstack 3
.locals init (float64 V_0)
IL_0000: ldarg.1
IL_0001: dup
IL_0002: ldind.r8
IL_0003: ldc.r8 1.5
IL_000c: div
IL_000d: dup
IL_000e: stloc.0
IL_000f: stind.r8
IL_0010: ldloc.0
IL_0011: ret
} // end of method CompoundAssignmentTest::CompoundAssignByPointer
.method public hidebysig instance void
CompoundAssignEnum() cil managed
{
// Code size 30 (0x1e)
.maxstack 8
IL_0000: ldarg.0
IL_0001: dup
IL_0002: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0007: ldc.i4.2
IL_0008: or
IL_0009: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000e: ldarg.0
IL_000f: dup
IL_0010: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0015: ldc.i4.s -5
IL_0017: and
IL_0018: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001d: ret
} // end of method CompoundAssignmentTest::CompoundAssignEnum
.method public hidebysig instance int32
PostIncrementInAddition(int32 i,
int32 j) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.1
IL_0001: dup
IL_0002: ldc.i4.1
IL_0003: add
IL_0004: starg.s i
IL_0006: ldarg.2
IL_0007: add
IL_0008: ret
} // end of method CompoundAssignmentTest::PostIncrementInAddition
.method public hidebysig instance void
PostIncrementInlineLocalVariable(class [mscorlib]System.Func`2<int32,int32> f) cil managed
{
// Code size 15 (0xf)
.maxstack 4
.locals init (int32 V_0)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: ldarg.1
IL_0003: ldloc.0
IL_0004: dup
IL_0005: ldc.i4.1
IL_0006: add
IL_0007: stloc.0
IL_0008: callvirt instance !1 class [mscorlib]System.Func`2<int32,int32>::Invoke(!0)
IL_000d: pop
IL_000e: ret
} // end of method CompoundAssignmentTest::PostIncrementInlineLocalVariable
.method public hidebysig instance int32
PostDecrementArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldobj [mscorlib]System.Int32
IL_000d: dup
IL_000e: stloc.0
IL_000f: ldc.i4.1
IL_0010: sub
IL_0011: stobj [mscorlib]System.Int32
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::PostDecrementArrayElement
.method public hidebysig instance int32
PostDecrementInstanceField() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: dup
IL_000d: stloc.0
IL_000e: ldc.i4.1
IL_000f: sub
IL_0010: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceField
.method public hidebysig instance int32
PostDecrementInstanceProperty() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: dup
IL_000d: stloc.0
IL_000e: ldc.i4.1
IL_000f: sub
IL_0010: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceProperty
.method public hidebysig instance int32
PostIncrement2DArray() cil managed
{
// Code size 38 (0x26)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0006: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000b: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0010: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_0015: dup
IL_0016: ldobj [mscorlib]System.Int32
IL_001b: dup
IL_001c: stloc.0
IL_001d: ldc.i4.1
IL_001e: add
IL_001f: stobj [mscorlib]System.Int32
IL_0024: ldloc.0
IL_0025: ret
} // end of method CompoundAssignmentTest::PostIncrement2DArray
.method public hidebysig instance int32
PostIncrementByRef(int32& i) cil managed
{
// Code size 10 (0xa)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: dup
IL_0002: ldind.i4
IL_0003: dup
IL_0004: stloc.0
IL_0005: ldc.i4.1
IL_0006: add
IL_0007: stind.i4
IL_0008: ldloc.0
IL_0009: ret
} // end of method CompoundAssignmentTest::PostIncrementByRef
.method public hidebysig instance int32
PostIncrementByPointer() cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0006: dup
IL_0007: ldind.i4
IL_0008: dup
IL_0009: stloc.0
IL_000a: ldc.i4.1
IL_000b: add
IL_000c: stind.i4
IL_000d: ldloc.0
IL_000e: ret
} // end of method CompoundAssignmentTest::PostIncrementByPointer
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

398
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il

@ -23219,6 +23219,404 @@ @@ -23219,6 +23219,404 @@
IL_005e: ret
} // end of method CompoundAssignmentTest::StringPropertyCompoundAssign
.method public hidebysig instance int32
PreIncrementByRef(int32& i) cil managed
{
// Code size 10 (0xa)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.1
IL_0002: ldind.i4
IL_0003: ldc.i4.1
IL_0004: add
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: stind.i4
IL_0008: ldloc.0
IL_0009: ret
} // end of method CompoundAssignmentTest::PreIncrementByRef
.method public hidebysig instance int32
PreIncrementByPointer() cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0006: dup
IL_0007: ldind.i4
IL_0008: ldc.i4.1
IL_0009: add
IL_000a: stloc.0
IL_000b: ldloc.0
IL_000c: stind.i4
IL_000d: ldloc.0
IL_000e: ret
} // end of method CompoundAssignmentTest::PreIncrementByPointer
.method public hidebysig instance int32
PreIncrement2DArray() cil managed
{
// Code size 22 (0x16)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0006: ldc.i4.1
IL_0007: ldc.i4.2
IL_0008: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000d: dup
IL_000e: ldind.i4
IL_000f: ldc.i4.1
IL_0010: add
IL_0011: stloc.0
IL_0012: ldloc.0
IL_0013: stind.i4
IL_0014: ldloc.0
IL_0015: ret
} // end of method CompoundAssignmentTest::PreIncrement2DArray
.method public hidebysig instance int32
CompoundAssignInstanceField() cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: ldc.i4.s 10
IL_000e: mul
IL_000f: dup
IL_0010: stloc.0
IL_0011: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceField
.method public hidebysig instance int32
CompoundAssignInstanceProperty() cil managed
{
// Code size 24 (0x18)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: ldc.i4.s 10
IL_000e: mul
IL_000f: dup
IL_0010: stloc.0
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0016: ldloc.0
IL_0017: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceProperty
.method public hidebysig instance int32
CompoundAssignStaticField() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0005: ldc.i4.s 100
IL_0007: xor
IL_0008: dup
IL_0009: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000e: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticField
.method public hidebysig instance int32
CompoundAssignStaticProperty() cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0005: ldc.i4.s 10
IL_0007: and
IL_0008: dup
IL_0009: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000e: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticProperty
.method public hidebysig instance int32
CompoundAssignArrayElement1(int32[] 'array',
int32 pos) cil managed
{
// Code size 17 (0x11)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldind.i4
IL_0009: ldc.i4.s 10
IL_000b: mul
IL_000c: dup
IL_000d: stloc.0
IL_000e: stind.i4
IL_000f: ldloc.0
IL_0010: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement1
.method public hidebysig instance int32
CompoundAssignArrayElement2(int32[] 'array') cil managed
{
// Code size 21 (0x15)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: call int32 [mscorlib]System.Environment::get_TickCount()
IL_0006: ldelema [mscorlib]System.Int32
IL_000b: dup
IL_000c: ldind.i4
IL_000d: ldc.i4.s 10
IL_000f: mul
IL_0010: dup
IL_0011: stloc.0
IL_0012: stind.i4
IL_0013: ldloc.0
IL_0014: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement2
.method public hidebysig instance int32
CompoundAssignIncrement2DArray() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0006: ldc.i4.1
IL_0007: ldc.i4.2
IL_0008: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000d: dup
IL_000e: ldind.i4
IL_000f: ldc.i4.s 10
IL_0011: rem
IL_0012: dup
IL_0013: stloc.0
IL_0014: stind.i4
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::CompoundAssignIncrement2DArray
.method public hidebysig instance int32
CompoundAssignByRef(int32& i) cil managed
{
// Code size 10 (0xa)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.1
IL_0002: ldind.i4
IL_0003: ldc.i4.2
IL_0004: shl
IL_0005: dup
IL_0006: stloc.0
IL_0007: stind.i4
IL_0008: ldloc.0
IL_0009: ret
} // end of method CompoundAssignmentTest::CompoundAssignByRef
.method public hidebysig instance float64
CompoundAssignByPointer(float64* ptr) cil managed
{
// Code size 18 (0x12)
.maxstack 3
.locals init (float64 V_0)
IL_0000: ldarg.1
IL_0001: dup
IL_0002: ldind.r8
IL_0003: ldc.r8 1.5
IL_000c: div
IL_000d: dup
IL_000e: stloc.0
IL_000f: stind.r8
IL_0010: ldloc.0
IL_0011: ret
} // end of method CompoundAssignmentTest::CompoundAssignByPointer
.method public hidebysig instance void
CompoundAssignEnum() cil managed
{
// Code size 30 (0x1e)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0007: ldc.i4.2
IL_0008: or
IL_0009: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000e: ldarg.0
IL_000f: ldarg.0
IL_0010: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0015: ldc.i4.s -5
IL_0017: and
IL_0018: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001d: ret
} // end of method CompoundAssignmentTest::CompoundAssignEnum
.method public hidebysig instance int32
PostIncrementInAddition(int32 i,
int32 j) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.1
IL_0001: dup
IL_0002: ldc.i4.1
IL_0003: add
IL_0004: starg.s i
IL_0006: ldarg.2
IL_0007: add
IL_0008: ret
} // end of method CompoundAssignmentTest::PostIncrementInAddition
.method public hidebysig instance void
PostIncrementInlineLocalVariable(class [mscorlib]System.Func`2<int32,int32> f) cil managed
{
// Code size 15 (0xf)
.maxstack 4
.locals init (int32 V_0)
IL_0000: ldc.i4.0
IL_0001: stloc.0
IL_0002: ldarg.1
IL_0003: ldloc.0
IL_0004: dup
IL_0005: ldc.i4.1
IL_0006: add
IL_0007: stloc.0
IL_0008: callvirt instance !1 class [mscorlib]System.Func`2<int32,int32>::Invoke(!0)
IL_000d: pop
IL_000e: ret
} // end of method CompoundAssignmentTest::PostIncrementInlineLocalVariable
.method public hidebysig instance int32
PostDecrementArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 16 (0x10)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.2
IL_0002: ldelema [mscorlib]System.Int32
IL_0007: dup
IL_0008: ldind.i4
IL_0009: stloc.0
IL_000a: ldloc.0
IL_000b: ldc.i4.1
IL_000c: sub
IL_000d: stind.i4
IL_000e: ldloc.0
IL_000f: ret
} // end of method CompoundAssignmentTest::PostDecrementArrayElement
.method public hidebysig instance int32
PostDecrementInstanceField() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000c: stloc.0
IL_000d: ldloc.0
IL_000e: ldc.i4.1
IL_000f: sub
IL_0010: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceField
.method public hidebysig instance int32
PostDecrementInstanceProperty() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0006: dup
IL_0007: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000c: stloc.0
IL_000d: ldloc.0
IL_000e: ldc.i4.1
IL_000f: sub
IL_0010: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0015: ldloc.0
IL_0016: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceProperty
.method public hidebysig instance int32
PostIncrement2DArray() cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0006: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000b: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0010: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_0015: dup
IL_0016: ldind.i4
IL_0017: stloc.0
IL_0018: ldloc.0
IL_0019: ldc.i4.1
IL_001a: add
IL_001b: stind.i4
IL_001c: ldloc.0
IL_001d: ret
} // end of method CompoundAssignmentTest::PostIncrement2DArray
.method public hidebysig instance int32
PostIncrementByRef(int32& i) cil managed
{
// Code size 10 (0xa)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.1
IL_0001: ldarg.1
IL_0002: ldind.i4
IL_0003: stloc.0
IL_0004: ldloc.0
IL_0005: ldc.i4.1
IL_0006: add
IL_0007: stind.i4
IL_0008: ldloc.0
IL_0009: ret
} // end of method CompoundAssignmentTest::PostIncrementByRef
.method public hidebysig instance int32
PostIncrementByPointer() cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0006: dup
IL_0007: ldind.i4
IL_0008: stloc.0
IL_0009: ldloc.0
IL_000a: ldc.i4.1
IL_000b: add
IL_000c: stind.i4
IL_000d: ldloc.0
IL_000e: ret
} // end of method CompoundAssignmentTest::PostIncrementByPointer
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

517
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il

@ -25592,6 +25592,523 @@ @@ -25592,6 +25592,523 @@
IL_0063: ret
} // end of method CompoundAssignmentTest::StringPropertyCompoundAssign
.method public hidebysig instance int32
PreIncrementByRef(int32& i) cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.1
IL_0003: ldind.i4
IL_0004: ldc.i4.1
IL_0005: add
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: stind.i4
IL_0009: ldloc.0
IL_000a: stloc.1
IL_000b: br.s IL_000d
IL_000d: ldloc.1
IL_000e: ret
} // end of method CompoundAssignmentTest::PreIncrementByRef
.method public hidebysig instance int32
PreIncrementByPointer() cil managed
{
// Code size 20 (0x14)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0007: dup
IL_0008: ldind.i4
IL_0009: ldc.i4.1
IL_000a: add
IL_000b: stloc.0
IL_000c: ldloc.0
IL_000d: stind.i4
IL_000e: ldloc.0
IL_000f: stloc.1
IL_0010: br.s IL_0012
IL_0012: ldloc.1
IL_0013: ret
} // end of method CompoundAssignmentTest::PreIncrementByPointer
.method public hidebysig instance int32
PreIncrement2DArray() cil managed
{
// Code size 27 (0x1b)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0007: ldc.i4.1
IL_0008: ldc.i4.2
IL_0009: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000e: dup
IL_000f: ldind.i4
IL_0010: ldc.i4.1
IL_0011: add
IL_0012: stloc.0
IL_0013: ldloc.0
IL_0014: stind.i4
IL_0015: ldloc.0
IL_0016: stloc.1
IL_0017: br.s IL_0019
IL_0019: ldloc.1
IL_001a: ret
} // end of method CompoundAssignmentTest::PreIncrement2DArray
.method public hidebysig instance int32
CompoundAssignInstanceField() cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: ldc.i4.s 10
IL_000f: mul
IL_0010: dup
IL_0011: stloc.0
IL_0012: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0017: ldloc.0
IL_0018: stloc.1
IL_0019: br.s IL_001b
IL_001b: ldloc.1
IL_001c: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceField
.method public hidebysig instance int32
CompoundAssignInstanceProperty() cil managed
{
// Code size 30 (0x1e)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: ldc.i4.s 10
IL_000f: mul
IL_0010: dup
IL_0011: stloc.0
IL_0012: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0017: nop
IL_0018: ldloc.0
IL_0019: stloc.1
IL_001a: br.s IL_001c
IL_001c: ldloc.1
IL_001d: ret
} // end of method CompoundAssignmentTest::CompoundAssignInstanceProperty
.method public hidebysig instance int32
CompoundAssignStaticField() cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_0006: ldc.i4.s 100
IL_0008: xor
IL_0009: dup
IL_000a: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticField
.method public hidebysig instance int32
CompoundAssignStaticProperty() cil managed
{
// Code size 21 (0x15)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0006: ldc.i4.s 10
IL_0008: and
IL_0009: dup
IL_000a: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::set_StaticProperty(int32)
IL_000f: nop
IL_0010: stloc.0
IL_0011: br.s IL_0013
IL_0013: ldloc.0
IL_0014: ret
} // end of method CompoundAssignmentTest::CompoundAssignStaticProperty
.method public hidebysig instance int32
CompoundAssignArrayElement1(int32[] 'array',
int32 pos) cil managed
{
// Code size 22 (0x16)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldind.i4
IL_000a: ldc.i4.s 10
IL_000c: mul
IL_000d: dup
IL_000e: stloc.0
IL_000f: stind.i4
IL_0010: ldloc.0
IL_0011: stloc.1
IL_0012: br.s IL_0014
IL_0014: ldloc.1
IL_0015: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement1
.method public hidebysig instance int32
CompoundAssignArrayElement2(int32[] 'array') cil managed
{
// Code size 26 (0x1a)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: call int32 [mscorlib]System.Environment::get_TickCount()
IL_0007: ldelema [mscorlib]System.Int32
IL_000c: dup
IL_000d: ldind.i4
IL_000e: ldc.i4.s 10
IL_0010: mul
IL_0011: dup
IL_0012: stloc.0
IL_0013: stind.i4
IL_0014: ldloc.0
IL_0015: stloc.1
IL_0016: br.s IL_0018
IL_0018: ldloc.1
IL_0019: ret
} // end of method CompoundAssignmentTest::CompoundAssignArrayElement2
.method public hidebysig instance int32
CompoundAssignIncrement2DArray() cil managed
{
// Code size 28 (0x1c)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0007: ldc.i4.1
IL_0008: ldc.i4.2
IL_0009: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_000e: dup
IL_000f: ldind.i4
IL_0010: ldc.i4.s 10
IL_0012: rem
IL_0013: dup
IL_0014: stloc.0
IL_0015: stind.i4
IL_0016: ldloc.0
IL_0017: stloc.1
IL_0018: br.s IL_001a
IL_001a: ldloc.1
IL_001b: ret
} // end of method CompoundAssignmentTest::CompoundAssignIncrement2DArray
.method public hidebysig instance int32
CompoundAssignByRef(int32& i) cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.1
IL_0003: ldind.i4
IL_0004: ldc.i4.2
IL_0005: shl
IL_0006: dup
IL_0007: stloc.0
IL_0008: stind.i4
IL_0009: ldloc.0
IL_000a: stloc.1
IL_000b: br.s IL_000d
IL_000d: ldloc.1
IL_000e: ret
} // end of method CompoundAssignmentTest::CompoundAssignByRef
.method public hidebysig instance float64
CompoundAssignByPointer(float64* ptr) cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (float64 V_0,
float64 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: dup
IL_0003: ldind.r8
IL_0004: ldc.r8 1.5
IL_000d: div
IL_000e: dup
IL_000f: stloc.0
IL_0010: stind.r8
IL_0011: ldloc.0
IL_0012: stloc.1
IL_0013: br.s IL_0015
IL_0015: ldloc.1
IL_0016: ret
} // end of method CompoundAssignmentTest::CompoundAssignByPointer
.method public hidebysig instance void
CompoundAssignEnum() cil managed
{
// Code size 31 (0x1f)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.0
IL_0003: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0008: ldc.i4.2
IL_0009: or
IL_000a: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_000f: ldarg.0
IL_0010: ldarg.0
IL_0011: ldfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_0016: ldc.i4.s -5
IL_0018: and
IL_0019: stfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MyEnum ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::enumField
IL_001e: ret
} // end of method CompoundAssignmentTest::CompoundAssignEnum
.method public hidebysig instance int32
PostIncrementInAddition(int32 i,
int32 j) cil managed
{
// Code size 14 (0xe)
.maxstack 3
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: dup
IL_0003: ldc.i4.1
IL_0004: add
IL_0005: starg.s i
IL_0007: ldarg.2
IL_0008: add
IL_0009: stloc.0
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ret
} // end of method CompoundAssignmentTest::PostIncrementInAddition
.method public hidebysig instance void
PostIncrementInlineLocalVariable(class [mscorlib]System.Func`2<int32,int32> f) cil managed
{
// Code size 16 (0x10)
.maxstack 4
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldc.i4.0
IL_0002: stloc.0
IL_0003: ldarg.1
IL_0004: ldloc.0
IL_0005: dup
IL_0006: ldc.i4.1
IL_0007: add
IL_0008: stloc.0
IL_0009: callvirt instance !1 class [mscorlib]System.Func`2<int32,int32>::Invoke(!0)
IL_000e: pop
IL_000f: ret
} // end of method CompoundAssignmentTest::PostIncrementInlineLocalVariable
.method public hidebysig instance int32
PostDecrementArrayElement(int32[] 'array',
int32 pos) cil managed
{
// Code size 21 (0x15)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.2
IL_0003: ldelema [mscorlib]System.Int32
IL_0008: dup
IL_0009: ldind.i4
IL_000a: stloc.0
IL_000b: ldloc.0
IL_000c: ldc.i4.1
IL_000d: sub
IL_000e: stind.i4
IL_000f: ldloc.0
IL_0010: stloc.1
IL_0011: br.s IL_0013
IL_0013: ldloc.1
IL_0014: ret
} // end of method CompoundAssignmentTest::PostDecrementArrayElement
.method public hidebysig instance int32
PostDecrementInstanceField() cil managed
{
// Code size 28 (0x1c)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_000d: stloc.0
IL_000e: ldloc.0
IL_000f: ldc.i4.1
IL_0010: sub
IL_0011: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::Field
IL_0016: ldloc.0
IL_0017: stloc.1
IL_0018: br.s IL_001a
IL_001a: ldloc.1
IL_001b: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceField
.method public hidebysig instance int32
PostDecrementInstanceProperty() cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::M()
IL_0007: dup
IL_0008: callvirt instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::get_Property()
IL_000d: stloc.0
IL_000e: ldloc.0
IL_000f: ldc.i4.1
IL_0010: sub
IL_0011: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest/MutableClass::set_Property(int32)
IL_0016: nop
IL_0017: ldloc.0
IL_0018: stloc.1
IL_0019: br.s IL_001b
IL_001b: ldloc.1
IL_001c: ret
} // end of method CompoundAssignmentTest::PostDecrementInstanceProperty
.method public hidebysig instance int32
PostIncrement2DArray() cil managed
{
// Code size 35 (0x23)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::Array()
IL_0007: ldsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::StaticField
IL_000c: call int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::get_StaticProperty()
IL_0011: call instance int32& int32[0...,0...]::Address(int32,
int32)
IL_0016: dup
IL_0017: ldind.i4
IL_0018: stloc.0
IL_0019: ldloc.0
IL_001a: ldc.i4.1
IL_001b: add
IL_001c: stind.i4
IL_001d: ldloc.0
IL_001e: stloc.1
IL_001f: br.s IL_0021
IL_0021: ldloc.1
IL_0022: ret
} // end of method CompoundAssignmentTest::PostIncrement2DArray
.method public hidebysig instance int32
PostIncrementByRef(int32& i) cil managed
{
// Code size 15 (0xf)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.1
IL_0003: ldind.i4
IL_0004: stloc.0
IL_0005: ldloc.0
IL_0006: ldc.i4.1
IL_0007: add
IL_0008: stind.i4
IL_0009: ldloc.0
IL_000a: stloc.1
IL_000b: br.s IL_000d
IL_000d: ldloc.1
IL_000e: ret
} // end of method CompoundAssignmentTest::PostIncrementByRef
.method public hidebysig instance int32
PostIncrementByPointer() cil managed
{
// Code size 20 (0x14)
.maxstack 3
.locals init (int32 V_0,
int32 V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.CompoundAssignmentTest::GetPointer()
IL_0007: dup
IL_0008: ldind.i4
IL_0009: stloc.0
IL_000a: ldloc.0
IL_000b: ldc.i4.1
IL_000c: add
IL_000d: stind.i4
IL_000e: ldloc.0
IL_000f: stloc.1
IL_0010: br.s IL_0012
IL_0012: ldloc.1
IL_0013: ret
} // end of method CompoundAssignmentTest::PostIncrementByPointer
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

13
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributeSamples.cs

@ -74,11 +74,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.CustomAttributeSamples @@ -74,11 +74,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.CustomAttributeSamples
public int Field;
[Obsolete("reason")]
#if ROSLYN
public int Property => 0;
#else
public int Property {
get {
return 0;
}
}
#endif
public int PropertyAttributeOnGetter {
[MyAttribute]
@ -97,12 +101,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.CustomAttributeSamples @@ -97,12 +101,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.CustomAttributeSamples
}
[Obsolete("reason")]
#if ROSLYN
public int this[int i] => 0;
#else
public int this[int i] {
get {
return 0;
}
}
#endif
[MyAttribute]
public event EventHandler MyEvent;
@ -250,11 +257,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.CustomAttributeSamples @@ -250,11 +257,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.CustomAttributeSamples
public class MyClass11
{
#if ROSLYN
public int this[[MyAttribute] string s] => 3;
#else
public int this[[MyAttribute] string s] {
get {
return 3;
}
}
#endif
}
public class MyClass12

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

@ -91,11 +91,15 @@ namespace CustomAttributes @@ -91,11 +91,15 @@ namespace CustomAttributes
[My(EnumWithFlag.Item1 | EnumWithFlag.Item2)]
private static int field;
[My(EnumWithFlag.All)]
#if ROSLYN
public static string Property => "aa";
#else
public static string Property {
get {
return "aa";
}
}
#endif
[Obsolete("some message")]
public static void ObsoletedMethod()
{

43
ICSharpCode.Decompiler.Tests/CustomAttributes.code.cs → ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.cs

@ -1,32 +1,47 @@ @@ -1,32 +1,47 @@
using System;
namespace aa
namespace CustomAttributes2
{
public static class CustomAtributes
{
[Flags]
public enum EnumWithFlag
{
All = 15,
None = 0,
Item1 = 1,
Item2 = 2,
Item3 = 4,
Item4 = 8
All = 0xF,
None = 0x0,
Item1 = 0x1,
Item2 = 0x2,
Item3 = 0x4,
Item4 = 0x8
}
[AttributeUsage(AttributeTargets.All)]
public class MyAttribute : Attribute
{
public MyAttribute(CustomAtributes.EnumWithFlag en)
public MyAttribute(EnumWithFlag en)
{
}
}
[CustomAtributes.MyAttribute(CustomAtributes.EnumWithFlag.Item1 | CustomAtributes.EnumWithFlag.Item2)]
[My(EnumWithFlag.Item1 | EnumWithFlag.Item2)]
private static int field;
[CustomAtributes.MyAttribute(CustomAtributes.EnumWithFlag.All)]
public static string Property
{
get
{
[My(EnumWithFlag.All)]
#if ROSLYN
public static string Property => "aa";
#else
public static string Property {
get {
return "aa";
}
}
#endif
public static string GetterOnlyPropertyWithAttributeOnGetter {
[My(EnumWithFlag.Item1)]
get {
return "aa";
}
}
[My(EnumWithFlag.All)]
public static string GetterOnlyPropertyWithAttributeOnGetter2 {
[My(EnumWithFlag.Item1)]
get {
return "aa";
}
}

166
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.il

@ -0,0 +1,166 @@ @@ -0,0 +1,166 @@
// 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 CustomAttributes2
{
.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.
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 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 CustomAttributes2.dll
.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 abstract auto ansi sealed beforefieldinit CustomAttributes2.CustomAtributes
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public EnumWithFlag
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag All = int32(0x0000000F)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag None = int32(0x00000000)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item1 = int32(0x00000001)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item2 = int32(0x00000002)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item3 = int32(0x00000004)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item4 = int32(0x00000008)
} // end of class EnumWithFlag
.class auto ansi nested public beforefieldinit MyAttribute
extends [mscorlib]System.Attribute
{
.custom instance void [mscorlib]System.AttributeUsageAttribute::.ctor(valuetype [mscorlib]System.AttributeTargets) = ( 01 00 FF 7F 00 00 00 00 )
.method public hidebysig specialname rtspecialname
instance void .ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag en) cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Attribute::.ctor()
IL_0006: nop
IL_0007: nop
IL_0008: nop
IL_0009: ret
} // end of method MyAttribute::.ctor
} // end of class MyAttribute
.field private static int32 'field'
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 03 00 00 00 00 00 )
.method public hidebysig specialname static
string get_Property() cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldstr "aa"
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method CustomAtributes::get_Property
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 11 (0xb)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldstr "aa"
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter2() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 11 (0xb)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldstr "aa"
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2
.method public hidebysig static void ObsoletedMethod() cil managed
{
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 0C 73 6F 6D 65 20 6D 65 73 73 61 67 65 00 // ...some message.
00 )
// Code size 66 (0x42)
.maxstack 3
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldstr "{0} $$$ {1}"
IL_0006: ldc.i4 0x400
IL_000b: box [mscorlib]System.AttributeTargets
IL_0010: ldc.i4 0x180
IL_0015: box [mscorlib]System.AttributeTargets
IL_001a: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_001f: nop
IL_0020: ldc.i4 0x180
IL_0025: stloc.0
IL_0026: ldstr "{0} $$$ {1}"
IL_002b: ldc.i4 0x400
IL_0030: box [mscorlib]System.AttributeTargets
IL_0035: ldloc.0
IL_0036: box [mscorlib]System.AttributeTargets
IL_003b: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0040: nop
IL_0041: ret
} // end of method CustomAtributes::ObsoletedMethod
.property string Property()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_Property()
} // end of property CustomAtributes::Property
.property string GetterOnlyPropertyWithAttributeOnGetter()
{
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter
.property string GetterOnlyPropertyWithAttributeOnGetter2()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter2
} // end of class CustomAttributes2.CustomAtributes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

142
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.opt.il

@ -0,0 +1,142 @@ @@ -0,0 +1,142 @@
// 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 CustomAttributes2.opt
{
.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.
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 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 CustomAttributes2.opt.dll
.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 abstract auto ansi sealed beforefieldinit CustomAttributes2.CustomAtributes
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public EnumWithFlag
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag All = int32(0x0000000F)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag None = int32(0x00000000)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item1 = int32(0x00000001)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item2 = int32(0x00000002)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item3 = int32(0x00000004)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item4 = int32(0x00000008)
} // end of class EnumWithFlag
.class auto ansi nested public beforefieldinit MyAttribute
extends [mscorlib]System.Attribute
{
.custom instance void [mscorlib]System.AttributeUsageAttribute::.ctor(valuetype [mscorlib]System.AttributeTargets) = ( 01 00 FF 7F 00 00 00 00 )
.method public hidebysig specialname rtspecialname
instance void .ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag en) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Attribute::.ctor()
IL_0006: ret
} // end of method MyAttribute::.ctor
} // end of class MyAttribute
.field private static int32 'field'
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 03 00 00 00 00 00 )
.method public hidebysig specialname static
string get_Property() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr "aa"
IL_0005: ret
} // end of method CustomAtributes::get_Property
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr "aa"
IL_0005: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter2() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr "aa"
IL_0005: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2
.method public hidebysig static void ObsoletedMethod() cil managed
{
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 0C 73 6F 6D 65 20 6D 65 73 73 61 67 65 00 // ...some message.
00 )
// Code size 63 (0x3f)
.maxstack 3
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: ldstr "{0} $$$ {1}"
IL_0005: ldc.i4 0x400
IL_000a: box [mscorlib]System.AttributeTargets
IL_000f: ldc.i4 0x180
IL_0014: box [mscorlib]System.AttributeTargets
IL_0019: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_001e: ldc.i4 0x180
IL_0023: stloc.0
IL_0024: ldstr "{0} $$$ {1}"
IL_0029: ldc.i4 0x400
IL_002e: box [mscorlib]System.AttributeTargets
IL_0033: ldloc.0
IL_0034: box [mscorlib]System.AttributeTargets
IL_0039: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_003e: ret
} // end of method CustomAtributes::ObsoletedMethod
.property string Property()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_Property()
} // end of property CustomAtributes::Property
.property string GetterOnlyPropertyWithAttributeOnGetter()
{
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter
.property string GetterOnlyPropertyWithAttributeOnGetter2()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter2
} // end of class CustomAttributes2.CustomAtributes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

146
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.opt.roslyn.il

@ -0,0 +1,146 @@ @@ -0,0 +1,146 @@
// 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 CustomAttributes2
{
.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 CustomAttributes2.dll
.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 abstract auto ansi sealed beforefieldinit CustomAttributes2.CustomAtributes
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public EnumWithFlag
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag All = int32(0x0000000F)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag None = int32(0x00000000)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item1 = int32(0x00000001)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item2 = int32(0x00000002)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item3 = int32(0x00000004)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item4 = int32(0x00000008)
} // end of class EnumWithFlag
.class auto ansi nested public beforefieldinit MyAttribute
extends [mscorlib]System.Attribute
{
.custom instance void [mscorlib]System.AttributeUsageAttribute::.ctor(valuetype [mscorlib]System.AttributeTargets) = ( 01 00 FF 7F 00 00 00 00 )
.method public hidebysig specialname rtspecialname
instance void .ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag en) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Attribute::.ctor()
IL_0006: ret
} // end of method MyAttribute::.ctor
} // end of class MyAttribute
.field private static int32 'field'
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 03 00 00 00 00 00 )
.method public hidebysig specialname static
string get_Property() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr "aa"
IL_0005: ret
} // end of method CustomAtributes::get_Property
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr "aa"
IL_0005: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter2() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr "aa"
IL_0005: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2
.method public hidebysig static void ObsoletedMethod() cil managed
{
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 0C 73 6F 6D 65 20 6D 65 73 73 61 67 65 00 // ...some message.
00 )
// Code size 63 (0x3f)
.maxstack 3
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: ldstr "{0} $$$ {1}"
IL_0005: ldc.i4 0x400
IL_000a: box [mscorlib]System.AttributeTargets
IL_000f: ldc.i4 0x180
IL_0014: box [mscorlib]System.AttributeTargets
IL_0019: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_001e: ldc.i4 0x180
IL_0023: stloc.0
IL_0024: ldstr "{0} $$$ {1}"
IL_0029: ldc.i4 0x400
IL_002e: box [mscorlib]System.AttributeTargets
IL_0033: ldloc.0
IL_0034: box [mscorlib]System.AttributeTargets
IL_0039: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_003e: ret
} // end of method CustomAtributes::ObsoletedMethod
.property string Property()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_Property()
} // end of property CustomAtributes::Property
.property string GetterOnlyPropertyWithAttributeOnGetter()
{
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter
.property string GetterOnlyPropertyWithAttributeOnGetter2()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter2
} // end of class CustomAttributes2.CustomAtributes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

163
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomAttributes2.roslyn.il

@ -0,0 +1,163 @@ @@ -0,0 +1,163 @@
// 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 CustomAttributes2
{
.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 CustomAttributes2.dll
.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 abstract auto ansi sealed beforefieldinit CustomAttributes2.CustomAtributes
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public EnumWithFlag
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag All = int32(0x0000000F)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag None = int32(0x00000000)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item1 = int32(0x00000001)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item2 = int32(0x00000002)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item3 = int32(0x00000004)
.field public static literal valuetype CustomAttributes2.CustomAtributes/EnumWithFlag Item4 = int32(0x00000008)
} // end of class EnumWithFlag
.class auto ansi nested public beforefieldinit MyAttribute
extends [mscorlib]System.Attribute
{
.custom instance void [mscorlib]System.AttributeUsageAttribute::.ctor(valuetype [mscorlib]System.AttributeTargets) = ( 01 00 FF 7F 00 00 00 00 )
.method public hidebysig specialname rtspecialname
instance void .ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag en) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Attribute::.ctor()
IL_0006: nop
IL_0007: nop
IL_0008: ret
} // end of method MyAttribute::.ctor
} // end of class MyAttribute
.field private static int32 'field'
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 03 00 00 00 00 00 )
.method public hidebysig specialname static
string get_Property() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldstr "aa"
IL_0005: ret
} // end of method CustomAtributes::get_Property
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 11 (0xb)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldstr "aa"
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter
.method public hidebysig specialname static
string get_GetterOnlyPropertyWithAttributeOnGetter2() cil managed
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 01 00 00 00 00 00 )
// Code size 11 (0xb)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldstr "aa"
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2
.method public hidebysig static void ObsoletedMethod() cil managed
{
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 0C 73 6F 6D 65 20 6D 65 73 73 61 67 65 00 // ...some message.
00 )
// Code size 66 (0x42)
.maxstack 3
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldstr "{0} $$$ {1}"
IL_0006: ldc.i4 0x400
IL_000b: box [mscorlib]System.AttributeTargets
IL_0010: ldc.i4 0x180
IL_0015: box [mscorlib]System.AttributeTargets
IL_001a: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_001f: nop
IL_0020: ldc.i4 0x180
IL_0025: stloc.0
IL_0026: ldstr "{0} $$$ {1}"
IL_002b: ldc.i4 0x400
IL_0030: box [mscorlib]System.AttributeTargets
IL_0035: ldloc.0
IL_0036: box [mscorlib]System.AttributeTargets
IL_003b: call void [mscorlib]System.Console::WriteLine(string,
object,
object)
IL_0040: nop
IL_0041: ret
} // end of method CustomAtributes::ObsoletedMethod
.property string Property()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_Property()
} // end of property CustomAtributes::Property
.property string GetterOnlyPropertyWithAttributeOnGetter()
{
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter
.property string GetterOnlyPropertyWithAttributeOnGetter2()
{
.custom instance void CustomAttributes2.CustomAtributes/MyAttribute::.ctor(valuetype CustomAttributes2.CustomAtributes/EnumWithFlag) = ( 01 00 0F 00 00 00 00 00 )
.get string CustomAttributes2.CustomAtributes::get_GetterOnlyPropertyWithAttributeOnGetter2()
} // end of property CustomAtributes::GetterOnlyPropertyWithAttributeOnGetter2
} // end of class CustomAttributes2.CustomAtributes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

42
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Discards.cs

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class Discards
{
public class @_
{
}
public void GetOut(out int value)
{
value = 0;
}
public void MakeValue(Func<object, string, int> func)
{
}
public void MakeValue(Func<@_, int> func)
{
}
public void SimpleParameter(@_ _)
{
}
public void ParameterHiddenByLocal(@_ _)
{
GetOut(out int _);
}
public void DiscardedOutVsLambdaParameter()
{
GetOut(out int _);
MakeValue((@_ _) => 5);
}
}
}

178
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Discards.opt.roslyn.il

@ -0,0 +1,178 @@ @@ -0,0 +1,178 @@
// 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 Discards
{
.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 Discards.dll
.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.Pretty.Discards
extends [mscorlib]System.Object
{
.class auto ansi nested public beforefieldinit _
extends [mscorlib]System.Object
{
.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 _::.ctor
} // end of class _
.class auto ansi serializable sealed nested private beforefieldinit '<>c'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c' '<>9'
.field public static class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> '<>9__6_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::.ctor()
IL_0005: stsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9'
IL_000a: ret
} // end of method '<>c'::.cctor
.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'::.ctor
.method assembly hidebysig instance int32
'<DiscardedOutVsLambdaParameter>b__6_0'(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_ _) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldc.i4.5
IL_0001: ret
} // end of method '<>c'::'<DiscardedOutVsLambdaParameter>b__6_0'
} // end of class '<>c'
.method public hidebysig instance void
GetOut([out] int32& 'value') cil managed
{
// Code size 4 (0x4)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldc.i4.0
IL_0002: stind.i4
IL_0003: ret
} // end of method Discards::GetOut
.method public hidebysig instance void
MakeValue(class [mscorlib]System.Func`3<object,string,int32> func) cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Discards::MakeValue
.method public hidebysig instance void
MakeValue(class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> func) cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Discards::MakeValue
.method public hidebysig instance void
SimpleParameter(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_ _) cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Discards::SimpleParameter
.method public hidebysig instance void
ParameterHiddenByLocal(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_ _) cil managed
{
// Code size 9 (0x9)
.maxstack 2
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: ldloca.s V_0
IL_0003: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards::GetOut(int32&)
IL_0008: ret
} // end of method Discards::ParameterHiddenByLocal
.method public hidebysig instance void
DiscardedOutVsLambdaParameter() cil managed
{
// Code size 46 (0x2e)
.maxstack 3
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: ldloca.s V_0
IL_0003: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards::GetOut(int32&)
IL_0008: ldarg.0
IL_0009: ldsfld class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9__6_0'
IL_000e: dup
IL_000f: brtrue.s IL_0028
IL_0011: pop
IL_0012: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9'
IL_0017: ldftn instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<DiscardedOutVsLambdaParameter>b__6_0'(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_)
IL_001d: newobj instance void class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32>::.ctor(object,
native int)
IL_0022: dup
IL_0023: stsfld class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9__6_0'
IL_0028: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards::MakeValue(class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32>)
IL_002d: ret
} // end of method Discards::DiscardedOutVsLambdaParameter
.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 Discards::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

190
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Discards.roslyn.il

@ -0,0 +1,190 @@ @@ -0,0 +1,190 @@
// 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 Discards
{
.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 Discards.dll
.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.Pretty.Discards
extends [mscorlib]System.Object
{
.class auto ansi nested public beforefieldinit _
extends [mscorlib]System.Object
{
.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 _::.ctor
} // end of class _
.class auto ansi serializable sealed nested private beforefieldinit '<>c'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c' '<>9'
.field public static class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> '<>9__6_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::.ctor()
IL_0005: stsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9'
IL_000a: ret
} // end of method '<>c'::.cctor
.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'::.ctor
.method assembly hidebysig instance int32
'<DiscardedOutVsLambdaParameter>b__6_0'(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_ _) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldc.i4.5
IL_0001: ret
} // end of method '<>c'::'<DiscardedOutVsLambdaParameter>b__6_0'
} // end of class '<>c'
.method public hidebysig instance void
GetOut([out] int32& 'value') cil managed
{
// Code size 5 (0x5)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.0
IL_0003: stind.i4
IL_0004: ret
} // end of method Discards::GetOut
.method public hidebysig instance void
MakeValue(class [mscorlib]System.Func`3<object,string,int32> func) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Discards::MakeValue
.method public hidebysig instance void
MakeValue(class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> func) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Discards::MakeValue
.method public hidebysig instance void
SimpleParameter(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_ _) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Discards::SimpleParameter
.method public hidebysig instance void
ParameterHiddenByLocal(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_ _) cil managed
{
// Code size 11 (0xb)
.maxstack 2
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldloca.s V_0
IL_0004: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards::GetOut(int32&)
IL_0009: nop
IL_000a: ret
} // end of method Discards::ParameterHiddenByLocal
.method public hidebysig instance void
DiscardedOutVsLambdaParameter() cil managed
{
// Code size 49 (0x31)
.maxstack 3
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldloca.s V_0
IL_0004: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards::GetOut(int32&)
IL_0009: nop
IL_000a: ldarg.0
IL_000b: ldsfld class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9__6_0'
IL_0010: dup
IL_0011: brtrue.s IL_002a
IL_0013: pop
IL_0014: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9'
IL_0019: ldftn instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<DiscardedOutVsLambdaParameter>b__6_0'(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_)
IL_001f: newobj instance void class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32>::.ctor(object,
native int)
IL_0024: dup
IL_0025: stsfld class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/'<>c'::'<>9__6_0'
IL_002a: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards::MakeValue(class [mscorlib]System.Func`2<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards/_,int32>)
IL_002f: nop
IL_0030: ret
} // end of method Discards::DiscardedOutVsLambdaParameter
.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 Discards::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Discards
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

119
ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.cs

@ -0,0 +1,119 @@ @@ -0,0 +1,119 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class EnumTests
{
public enum SimpleEnum
{
Item1,
Item2
}
public enum LongBasedEnum : long
{
Item1,
Item2
}
public enum LongWithInitializers : long
{
Item1 = 0L,
Item2 = 20L,
Item3 = 21L
}
public enum ShortWithInitializers : short
{
Item1 = 0,
Item2 = 20,
Item3 = 21
}
public enum ByteWithInitializers : byte
{
Item1 = 0,
Item2 = 20,
Item3 = 21
}
[Flags]
public enum SimpleFlagsEnum
{
None = 0x0,
Item1 = 0x1,
Item2 = 0x2,
Item3 = 0x4,
All = 0x7
}
[Flags]
public enum NegativeValueWithFlags
{
Value = -2147483647
}
public enum NegativeValueWithoutFlags
{
Value = -2147483647
}
public AttributeTargets SingleEnumValue()
{
return AttributeTargets.Class;
}
public AttributeTargets TwoEnumValuesOr()
{
return AttributeTargets.Class | AttributeTargets.Method;
}
public AttributeTargets ThreeEnumValuesOr()
{
return AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Parameter;
}
public AttributeTargets UnknownEnumValue()
{
return (AttributeTargets)1000000;
}
public AttributeTargets EnumAllValue()
{
return AttributeTargets.All;
}
public AttributeTargets EnumZeroValue()
{
return (AttributeTargets)0;
}
public object PreservingTypeWhenBoxed()
{
return AttributeTargets.Delegate;
}
public object PreservingTypeWhenBoxedTwoEnum()
{
return AttributeTargets.Class | AttributeTargets.Delegate;
}
}
}

242
ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.il

@ -0,0 +1,242 @@ @@ -0,0 +1,242 @@
// 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 EnumTests
{
.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.
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 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 EnumTests.dll
.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.Pretty.EnumTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public SimpleEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item1 = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item2 = int32(0x00000001)
} // end of class SimpleEnum
.class auto ansi sealed nested public LongBasedEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item2 = int64(0x1)
} // end of class LongBasedEnum
.class auto ansi sealed nested public LongWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item2 = int64(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item3 = int64(0x15)
} // end of class LongWithInitializers
.class auto ansi sealed nested public ShortWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int16 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item1 = int16(0x0000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item2 = int16(0x0014)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item3 = int16(0x0015)
} // end of class ShortWithInitializers
.class auto ansi sealed nested public ByteWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname uint8 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item1 = uint8(0x00)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item2 = uint8(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item3 = uint8(0x15)
} // end of class ByteWithInitializers
.class auto ansi sealed nested public SimpleFlagsEnum
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum None = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item1 = int32(0x00000001)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item2 = int32(0x00000002)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item3 = int32(0x00000004)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum All = int32(0x00000007)
} // end of class SimpleFlagsEnum
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
SingleEnumValue() cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method EnumTests::SingleEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
TwoEnumValuesOr() cil managed
{
// Code size 8 (0x8)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4.s 68
IL_0003: stloc.0
IL_0004: br.s IL_0006
IL_0006: ldloc.0
IL_0007: ret
} // end of method EnumTests::TwoEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
ThreeEnumValuesOr() cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4 0x844
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method EnumTests::ThreeEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
UnknownEnumValue() cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4 0xf4240
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method EnumTests::UnknownEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumAllValue() cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4 0x7fff
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method EnumTests::EnumAllValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumZeroValue() cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4.0
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method EnumTests::EnumZeroValue
.method public hidebysig instance object
PreservingTypeWhenBoxed() cil managed
{
// Code size 16 (0x10)
.maxstack 1
.locals init (object V_0)
IL_0000: nop
IL_0001: ldc.i4 0x1000
IL_0006: box [mscorlib]System.AttributeTargets
IL_000b: stloc.0
IL_000c: br.s IL_000e
IL_000e: ldloc.0
IL_000f: ret
} // end of method EnumTests::PreservingTypeWhenBoxed
.method public hidebysig instance object
PreservingTypeWhenBoxedTwoEnum() cil managed
{
// Code size 16 (0x10)
.maxstack 1
.locals init (object V_0)
IL_0000: nop
IL_0001: ldc.i4 0x1004
IL_0006: box [mscorlib]System.AttributeTargets
IL_000b: stloc.0
IL_000c: br.s IL_000e
IL_000e: ldloc.0
IL_000f: ret
} // end of method EnumTests::PreservingTypeWhenBoxedTwoEnum
.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 EnumTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

194
ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.opt.il

@ -0,0 +1,194 @@ @@ -0,0 +1,194 @@
// 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 EnumTests.opt
{
.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.
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 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 EnumTests.opt.dll
.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.Pretty.EnumTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public SimpleEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item1 = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item2 = int32(0x00000001)
} // end of class SimpleEnum
.class auto ansi sealed nested public LongBasedEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item2 = int64(0x1)
} // end of class LongBasedEnum
.class auto ansi sealed nested public LongWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item2 = int64(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item3 = int64(0x15)
} // end of class LongWithInitializers
.class auto ansi sealed nested public ShortWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int16 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item1 = int16(0x0000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item2 = int16(0x0014)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item3 = int16(0x0015)
} // end of class ShortWithInitializers
.class auto ansi sealed nested public ByteWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname uint8 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item1 = uint8(0x00)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item2 = uint8(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item3 = uint8(0x15)
} // end of class ByteWithInitializers
.class auto ansi sealed nested public SimpleFlagsEnum
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum None = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item1 = int32(0x00000001)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item2 = int32(0x00000002)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item3 = int32(0x00000004)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum All = int32(0x00000007)
} // end of class SimpleFlagsEnum
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
SingleEnumValue() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldc.i4.4
IL_0001: ret
} // end of method EnumTests::SingleEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
TwoEnumValuesOr() cil managed
{
// Code size 3 (0x3)
.maxstack 8
IL_0000: ldc.i4.s 68
IL_0002: ret
} // end of method EnumTests::TwoEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
ThreeEnumValuesOr() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldc.i4 0x844
IL_0005: ret
} // end of method EnumTests::ThreeEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
UnknownEnumValue() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldc.i4 0xf4240
IL_0005: ret
} // end of method EnumTests::UnknownEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumAllValue() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldc.i4 0x7fff
IL_0005: ret
} // end of method EnumTests::EnumAllValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumZeroValue() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldc.i4.0
IL_0001: ret
} // end of method EnumTests::EnumZeroValue
.method public hidebysig instance object
PreservingTypeWhenBoxed() cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldc.i4 0x1000
IL_0005: box [mscorlib]System.AttributeTargets
IL_000a: ret
} // end of method EnumTests::PreservingTypeWhenBoxed
.method public hidebysig instance object
PreservingTypeWhenBoxedTwoEnum() cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldc.i4 0x1004
IL_0005: box [mscorlib]System.AttributeTargets
IL_000a: ret
} // end of method EnumTests::PreservingTypeWhenBoxedTwoEnum
.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 EnumTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

198
ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.opt.roslyn.il

@ -0,0 +1,198 @@ @@ -0,0 +1,198 @@
// 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 EnumTests
{
.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 EnumTests.dll
.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.Pretty.EnumTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public SimpleEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item1 = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item2 = int32(0x00000001)
} // end of class SimpleEnum
.class auto ansi sealed nested public LongBasedEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item2 = int64(0x1)
} // end of class LongBasedEnum
.class auto ansi sealed nested public LongWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item2 = int64(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item3 = int64(0x15)
} // end of class LongWithInitializers
.class auto ansi sealed nested public ShortWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int16 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item1 = int16(0x0000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item2 = int16(0x0014)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item3 = int16(0x0015)
} // end of class ShortWithInitializers
.class auto ansi sealed nested public ByteWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname uint8 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item1 = uint8(0x00)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item2 = uint8(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item3 = uint8(0x15)
} // end of class ByteWithInitializers
.class auto ansi sealed nested public SimpleFlagsEnum
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum None = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item1 = int32(0x00000001)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item2 = int32(0x00000002)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item3 = int32(0x00000004)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum All = int32(0x00000007)
} // end of class SimpleFlagsEnum
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
SingleEnumValue() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldc.i4.4
IL_0001: ret
} // end of method EnumTests::SingleEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
TwoEnumValuesOr() cil managed
{
// Code size 3 (0x3)
.maxstack 8
IL_0000: ldc.i4.s 68
IL_0002: ret
} // end of method EnumTests::TwoEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
ThreeEnumValuesOr() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldc.i4 0x844
IL_0005: ret
} // end of method EnumTests::ThreeEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
UnknownEnumValue() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldc.i4 0xf4240
IL_0005: ret
} // end of method EnumTests::UnknownEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumAllValue() cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: ldc.i4 0x7fff
IL_0005: ret
} // end of method EnumTests::EnumAllValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumZeroValue() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldc.i4.0
IL_0001: ret
} // end of method EnumTests::EnumZeroValue
.method public hidebysig instance object
PreservingTypeWhenBoxed() cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldc.i4 0x1000
IL_0005: box [mscorlib]System.AttributeTargets
IL_000a: ret
} // end of method EnumTests::PreservingTypeWhenBoxed
.method public hidebysig instance object
PreservingTypeWhenBoxedTwoEnum() cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldc.i4 0x1004
IL_0005: box [mscorlib]System.AttributeTargets
IL_000a: ret
} // end of method EnumTests::PreservingTypeWhenBoxedTwoEnum
.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 EnumTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

247
ICSharpCode.Decompiler.Tests/TestCases/Pretty/EnumTests.roslyn.il

@ -0,0 +1,247 @@ @@ -0,0 +1,247 @@
// 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 EnumTests
{
.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 EnumTests.dll
.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.Pretty.EnumTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public SimpleEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item1 = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleEnum Item2 = int32(0x00000001)
} // end of class SimpleEnum
.class auto ansi sealed nested public LongBasedEnum
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongBasedEnum Item2 = int64(0x1)
} // end of class LongBasedEnum
.class auto ansi sealed nested public LongWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int64 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item1 = int64(0x0)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item2 = int64(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/LongWithInitializers Item3 = int64(0x15)
} // end of class LongWithInitializers
.class auto ansi sealed nested public ShortWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int16 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item1 = int16(0x0000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item2 = int16(0x0014)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ShortWithInitializers Item3 = int16(0x0015)
} // end of class ShortWithInitializers
.class auto ansi sealed nested public ByteWithInitializers
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname uint8 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item1 = uint8(0x00)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item2 = uint8(0x14)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/ByteWithInitializers Item3 = uint8(0x15)
} // end of class ByteWithInitializers
.class auto ansi sealed nested public SimpleFlagsEnum
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum None = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item1 = int32(0x00000001)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item2 = int32(0x00000002)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum Item3 = int32(0x00000004)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/SimpleFlagsEnum All = int32(0x00000007)
} // end of class SimpleFlagsEnum
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
SingleEnumValue() cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method EnumTests::SingleEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
TwoEnumValuesOr() cil managed
{
// Code size 8 (0x8)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4.s 68
IL_0003: stloc.0
IL_0004: br.s IL_0006
IL_0006: ldloc.0
IL_0007: ret
} // end of method EnumTests::TwoEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
ThreeEnumValuesOr() cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4 0x844
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method EnumTests::ThreeEnumValuesOr
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
UnknownEnumValue() cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4 0xf4240
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method EnumTests::UnknownEnumValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumAllValue() cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4 0x7fff
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method EnumTests::EnumAllValue
.method public hidebysig instance valuetype [mscorlib]System.AttributeTargets
EnumZeroValue() cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (valuetype [mscorlib]System.AttributeTargets V_0)
IL_0000: nop
IL_0001: ldc.i4.0
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method EnumTests::EnumZeroValue
.method public hidebysig instance object
PreservingTypeWhenBoxed() cil managed
{
// Code size 16 (0x10)
.maxstack 1
.locals init (object V_0)
IL_0000: nop
IL_0001: ldc.i4 0x1000
IL_0006: box [mscorlib]System.AttributeTargets
IL_000b: stloc.0
IL_000c: br.s IL_000e
IL_000e: ldloc.0
IL_000f: ret
} // end of method EnumTests::PreservingTypeWhenBoxed
.method public hidebysig instance object
PreservingTypeWhenBoxedTwoEnum() cil managed
{
// Code size 16 (0x10)
.maxstack 1
.locals init (object V_0)
IL_0000: nop
IL_0001: ldc.i4 0x1004
IL_0006: box [mscorlib]System.AttributeTargets
IL_000b: stloc.0
IL_000c: br.s IL_000e
IL_000e: ldloc.0
IL_000f: ret
} // end of method EnumTests::PreservingTypeWhenBoxedTwoEnum
.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 EnumTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.EnumTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

156
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.cs

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
@ -37,6 +38,73 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -37,6 +38,73 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
}
public class MyArray<T>
{
public class NestedClass<Y>
{
public T Item1;
public Y Item2;
}
public enum NestedEnum
{
A,
B
}
private T[] arr;
public MyArray(int capacity)
{
arr = new T[capacity];
}
public void Size(int capacity)
{
Array.Resize(ref arr, capacity);
}
public void Grow(int capacity)
{
if (capacity >= arr.Length) {
Size(capacity);
}
}
}
public interface IInterface
{
void Method1<T>() where T : class;
void Method2<T>() where T : class;
}
public abstract class Base : IInterface
{
// constraints must be repeated on implicit interface implementation
public abstract void Method1<T>() where T : class;
// constraints must not be specified on explicit interface implementation
void IInterface.Method2<T>()
{
}
}
public class Derived : Base
{
// constraints are inherited automatically and must not be specified
public override void Method1<T>()
{
}
}
private const MyArray<string>.NestedEnum enumVal = MyArray<string>.NestedEnum.A;
private static Type type1 = typeof(List<>);
private static Type type2 = typeof(MyArray<>);
private static Type type3 = typeof(List<>.Enumerator);
private static Type type4 = typeof(MyArray<>.NestedClass<>);
private static Type type5 = typeof(List<int>[]);
private static Type type6 = typeof(MyArray<>.NestedEnum);
public T CastToTypeParameter<T>(DerivedClass d) where T : BaseClass
{
return (T)(BaseClass)d;
@ -97,6 +165,94 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -97,6 +165,94 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
return new T[size1, size2];
}
public Type[] TestTypeOf()
{
return new Type[8] {
typeof(int),
typeof(int[]),
typeof(GenericClass<>),
typeof(GenericClass<int>),
typeof(GenericClass<int[]>),
typeof(Dictionary<, >),
typeof(List<int>.Enumerator),
typeof(List<>.Enumerator)
};
}
public static void MethodWithConstraint<T, S>() where T : class, S where S : ICloneable, new()
{
}
public static void MethodWithStructConstraint<T>() where T : struct
{
}
private static void MultidimensionalArray<T>(T[,] array)
{
array[0, 0] = array[0, 1];
}
public static Dictionary<string, string>.KeyCollection.Enumerator GetEnumerator(Dictionary<string, string> d, MyArray<string>.NestedClass<int> nc)
{
// Tests references to inner classes in generic classes
return d.Keys.GetEnumerator();
}
public static bool IsString<T>(T input)
{
return input is string;
}
public static string AsString<T>(T input)
{
return input as string;
}
public static string CastToString<T>(T input)
{
return (string)(object)input;
}
public static T CastFromString<T>(string input)
{
return (T)(object)input;
}
public static bool IsInt<T>(T input)
{
return input is int;
}
public static int CastToInt<T>(T input)
{
return (int)(object)input;
}
public static T CastFromInt<T>(int input)
{
return (T)(object)input;
}
public static bool IsNullableInt<T>(T input)
{
return input is int?;
}
public static int? AsNullableInt<T>(T input)
{
return input as int?;
}
public static int? CastToNullableInt<T>(T input)
{
return (int?)(object)input;
}
public static T CastFromNullableInt<T>(int? input)
{
return (T)(object)input;
}
#if CS73
public static object CallDelegate<T>(T input) where T : Delegate
{

489
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.il

@ -89,6 +89,171 @@ @@ -89,6 +89,171 @@
} // end of class DerivedClass
.class auto ansi nested public beforefieldinit MyArray`1<T>
extends [mscorlib]System.Object
{
.class auto ansi nested public beforefieldinit NestedClass`1<T,Y>
extends [mscorlib]System.Object
{
.field public !T Item1
.field public !Y Item2
.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 NestedClass`1::.ctor
} // end of class NestedClass`1
.class auto ansi sealed nested public NestedEnum<T>
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> A = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> B = int32(0x00000001)
} // end of class NestedEnum
.field private !T[] arr
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 capacity) cil managed
{
// Code size 22 (0x16)
.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: newarr !T
IL_000f: stfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0014: nop
IL_0015: ret
} // end of method MyArray`1::.ctor
.method public hidebysig instance void
Size(int32 capacity) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldflda !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0007: ldarg.1
IL_0008: call void [mscorlib]System.Array::Resize<!T>(!!0[]&,
int32)
IL_000d: nop
IL_000e: ret
} // end of method MyArray`1::Size
.method public hidebysig instance void
Grow(int32 capacity) cil managed
{
// Code size 27 (0x1b)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.0
IL_0003: ldfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0008: ldlen
IL_0009: conv.i4
IL_000a: clt
IL_000c: stloc.0
IL_000d: ldloc.0
IL_000e: brtrue.s IL_001a
IL_0010: nop
IL_0011: ldarg.0
IL_0012: ldarg.1
IL_0013: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::Size(int32)
IL_0018: nop
IL_0019: nop
IL_001a: ret
} // end of method MyArray`1::Grow
} // end of class MyArray`1
.class interface abstract auto ansi nested public IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method IInterface::Method1
.method public hidebysig newslot abstract virtual
instance void Method2<class T>() cil managed
{
} // end of method IInterface::Method2
} // end of class IInterface
.class abstract auto ansi nested public beforefieldinit Base
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method Base::Method1
.method private hidebysig newslot virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2<class T>() cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface::Method2
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Base::ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2
.method family 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 Base::.ctor
} // end of class Base
.class auto ansi nested public beforefieldinit Derived
extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base
{
.method public hidebysig virtual instance void
Method1<class T>() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Derived::Method1
.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 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base::.ctor()
IL_0006: ret
} // end of method Derived::.ctor
} // end of class Derived
.field private static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<string> enumVal = int32(0x00000000)
.field private static class [mscorlib]System.Type type1
.field private static class [mscorlib]System.Type type2
.field private static class [mscorlib]System.Type type3
.field private static class [mscorlib]System.Type type4
.field private static class [mscorlib]System.Type type5
.field private static class [mscorlib]System.Type type6
.method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed
{
// Code size 12 (0xc)
@ -304,6 +469,304 @@ @@ -304,6 +469,304 @@
IL_000c: ret
} // end of method Generics::NewArray
.method public hidebysig instance class [mscorlib]System.Type[]
TestTypeOf() cil managed
{
// Code size 118 (0x76)
.maxstack 3
.locals init (class [mscorlib]System.Type[] V_0,
class [mscorlib]System.Type[] V_1)
IL_0000: nop
IL_0001: ldc.i4.8
IL_0002: newarr [mscorlib]System.Type
IL_0007: stloc.1
IL_0008: ldloc.1
IL_0009: ldc.i4.0
IL_000a: ldtoken [mscorlib]System.Int32
IL_000f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0014: stelem.ref
IL_0015: ldloc.1
IL_0016: ldc.i4.1
IL_0017: ldtoken int32[]
IL_001c: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0021: stelem.ref
IL_0022: ldloc.1
IL_0023: ldc.i4.2
IL_0024: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1
IL_0029: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_002e: stelem.ref
IL_002f: ldloc.1
IL_0030: ldc.i4.3
IL_0031: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32>
IL_0036: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_003b: stelem.ref
IL_003c: ldloc.1
IL_003d: ldc.i4.4
IL_003e: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32[]>
IL_0043: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0048: stelem.ref
IL_0049: ldloc.1
IL_004a: ldc.i4.5
IL_004b: ldtoken [mscorlib]System.Collections.Generic.Dictionary`2
IL_0050: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0055: stelem.ref
IL_0056: ldloc.1
IL_0057: ldc.i4.6
IL_0058: ldtoken valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator<int32>
IL_005d: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0062: stelem.ref
IL_0063: ldloc.1
IL_0064: ldc.i4.7
IL_0065: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_006a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_006f: stelem.ref
IL_0070: ldloc.1
IL_0071: stloc.0
IL_0072: br.s IL_0074
IL_0074: ldloc.0
IL_0075: ret
} // end of method Generics::TestTypeOf
.method public hidebysig static void MethodWithConstraint<class (!!S) T,.ctor ([mscorlib]System.ICloneable) S>() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Generics::MethodWithConstraint
.method public hidebysig static void MethodWithStructConstraint<valuetype .ctor ([mscorlib]System.ValueType) T>() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Generics::MethodWithStructConstraint
.method private hidebysig static void MultidimensionalArray<T>(!!T[0...,0...] 'array') cil managed
{
// Code size 18 (0x12)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.0
IL_0003: ldc.i4.0
IL_0004: ldarg.0
IL_0005: ldc.i4.0
IL_0006: ldc.i4.1
IL_0007: call instance !!T !!T[0...,0...]::Get(int32,
int32)
IL_000c: call instance void !!T[0...,0...]::Set(int32,
int32,
!!T)
IL_0011: ret
} // end of method Generics::MultidimensionalArray
.method public hidebysig static valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<string,string>
GetEnumerator(class [mscorlib]System.Collections.Generic.Dictionary`2<string,string> d,
class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1<string,int32> nc) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<string,string> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<string,string>::get_Keys()
IL_0007: callvirt instance valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<string,string>::GetEnumerator()
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::GetEnumerator
.method public hidebysig static bool IsString<T>(!!T input) cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst [mscorlib]System.String
IL_000c: ldnull
IL_000d: cgt.un
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method Generics::IsString
.method public hidebysig static string
AsString<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst [mscorlib]System.String
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::AsString
.method public hidebysig static string
CastToString<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: castclass [mscorlib]System.String
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastToString
.method public hidebysig static !!T CastFromString<T>(string input) cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (!!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: unbox.any !!T
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method Generics::CastFromString
.method public hidebysig static bool IsInt<T>(!!T input) cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst [mscorlib]System.Int32
IL_000c: ldnull
IL_000d: cgt.un
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method Generics::IsInt
.method public hidebysig static int32 CastToInt<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: unbox.any [mscorlib]System.Int32
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastToInt
.method public hidebysig static !!T CastFromInt<T>(int32 input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (!!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box [mscorlib]System.Int32
IL_0007: unbox.any !!T
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastFromInt
.method public hidebysig static bool IsNullableInt<T>(!!T input) cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000c: ldnull
IL_000d: cgt.un
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method Generics::IsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
AsNullableInt<T>(!!T input) cil managed
{
// Code size 22 (0x16)
.maxstack 1
.locals init (valuetype [mscorlib]System.Nullable`1<int32> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000c: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_0011: stloc.0
IL_0012: br.s IL_0014
IL_0014: ldloc.0
IL_0015: ret
} // end of method Generics::AsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
CastToNullableInt<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype [mscorlib]System.Nullable`1<int32> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastToNullableInt
.method public hidebysig static !!T CastFromNullableInt<T>(valuetype [mscorlib]System.Nullable`1<int32> input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (!!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box valuetype [mscorlib]System.Nullable`1<int32>
IL_0007: unbox.any !!T
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastFromNullableInt
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -314,6 +777,32 @@ @@ -314,6 +777,32 @@
IL_0006: ret
} // end of method Generics::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 91 (0x5b)
.maxstack 1
IL_0000: ldtoken [mscorlib]System.Collections.Generic.List`1
IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_000a: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type1
IL_000f: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1
IL_0014: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0019: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type2
IL_001e: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_0023: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0028: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type3
IL_002d: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1
IL_0032: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0037: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type4
IL_003c: ldtoken class [mscorlib]System.Collections.Generic.List`1<int32>[]
IL_0041: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0046: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type5
IL_004b: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum
IL_0050: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0055: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type6
IL_005a: ret
} // end of method Generics::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics

393
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.il

@ -88,6 +88,156 @@ @@ -88,6 +88,156 @@
} // end of class DerivedClass
.class auto ansi nested public beforefieldinit MyArray`1<T>
extends [mscorlib]System.Object
{
.class auto ansi nested public beforefieldinit NestedClass`1<T,Y>
extends [mscorlib]System.Object
{
.field public !T Item1
.field public !Y Item2
.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 NestedClass`1::.ctor
} // end of class NestedClass`1
.class auto ansi sealed nested public NestedEnum<T>
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> A = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> B = int32(0x00000001)
} // end of class NestedEnum
.field private !T[] arr
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 capacity) cil managed
{
// Code size 19 (0x13)
.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: newarr !T
IL_000d: stfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0012: ret
} // end of method MyArray`1::.ctor
.method public hidebysig instance void
Size(int32 capacity) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0006: ldarg.1
IL_0007: call void [mscorlib]System.Array::Resize<!T>(!!0[]&,
int32)
IL_000c: ret
} // end of method MyArray`1::Size
.method public hidebysig instance void
Grow(int32 capacity) cil managed
{
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.0
IL_0002: ldfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0007: ldlen
IL_0008: conv.i4
IL_0009: blt.s IL_0012
IL_000b: ldarg.0
IL_000c: ldarg.1
IL_000d: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::Size(int32)
IL_0012: ret
} // end of method MyArray`1::Grow
} // end of class MyArray`1
.class interface abstract auto ansi nested public IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method IInterface::Method1
.method public hidebysig newslot abstract virtual
instance void Method2<class T>() cil managed
{
} // end of method IInterface::Method2
} // end of class IInterface
.class abstract auto ansi nested public beforefieldinit Base
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method Base::Method1
.method private hidebysig newslot virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2<class T>() cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface::Method2
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Base::ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2
.method family 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 Base::.ctor
} // end of class Base
.class auto ansi nested public beforefieldinit Derived
extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base
{
.method public hidebysig virtual instance void
Method1<class T>() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Derived::Method1
.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 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base::.ctor()
IL_0006: ret
} // end of method Derived::.ctor
} // end of class Derived
.field private static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<string> enumVal = int32(0x00000000)
.field private static class [mscorlib]System.Type type1
.field private static class [mscorlib]System.Type type2
.field private static class [mscorlib]System.Type type3
.field private static class [mscorlib]System.Type type4
.field private static class [mscorlib]System.Type type5
.field private static class [mscorlib]System.Type type6
.method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed
{
// Code size 7 (0x7)
@ -231,6 +381,223 @@ @@ -231,6 +381,223 @@
IL_0007: ret
} // end of method Generics::NewArray
.method public hidebysig instance class [mscorlib]System.Type[]
TestTypeOf() cil managed
{
// Code size 113 (0x71)
.maxstack 3
.locals init (class [mscorlib]System.Type[] V_0)
IL_0000: ldc.i4.8
IL_0001: newarr [mscorlib]System.Type
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.0
IL_0009: ldtoken [mscorlib]System.Int32
IL_000e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0013: stelem.ref
IL_0014: ldloc.0
IL_0015: ldc.i4.1
IL_0016: ldtoken int32[]
IL_001b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0020: stelem.ref
IL_0021: ldloc.0
IL_0022: ldc.i4.2
IL_0023: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1
IL_0028: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_002d: stelem.ref
IL_002e: ldloc.0
IL_002f: ldc.i4.3
IL_0030: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32>
IL_0035: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_003a: stelem.ref
IL_003b: ldloc.0
IL_003c: ldc.i4.4
IL_003d: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32[]>
IL_0042: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0047: stelem.ref
IL_0048: ldloc.0
IL_0049: ldc.i4.5
IL_004a: ldtoken [mscorlib]System.Collections.Generic.Dictionary`2
IL_004f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0054: stelem.ref
IL_0055: ldloc.0
IL_0056: ldc.i4.6
IL_0057: ldtoken valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator<int32>
IL_005c: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0061: stelem.ref
IL_0062: ldloc.0
IL_0063: ldc.i4.7
IL_0064: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_0069: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_006e: stelem.ref
IL_006f: ldloc.0
IL_0070: ret
} // end of method Generics::TestTypeOf
.method public hidebysig static void MethodWithConstraint<class (!!S) T,.ctor ([mscorlib]System.ICloneable) S>() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Generics::MethodWithConstraint
.method public hidebysig static void MethodWithStructConstraint<valuetype .ctor ([mscorlib]System.ValueType) T>() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Generics::MethodWithStructConstraint
.method private hidebysig static void MultidimensionalArray<T>(!!T[0...,0...] 'array') cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: ldc.i4.0
IL_0003: ldarg.0
IL_0004: ldc.i4.0
IL_0005: ldc.i4.1
IL_0006: call instance !!T !!T[0...,0...]::Get(int32,
int32)
IL_000b: call instance void !!T[0...,0...]::Set(int32,
int32,
!!T)
IL_0010: ret
} // end of method Generics::MultidimensionalArray
.method public hidebysig static valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<string,string>
GetEnumerator(class [mscorlib]System.Collections.Generic.Dictionary`2<string,string> d,
class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1<string,int32> nc) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<string,string>::get_Keys()
IL_0006: callvirt instance valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<string,string>::GetEnumerator()
IL_000b: ret
} // end of method Generics::GetEnumerator
.method public hidebysig static bool IsString<T>(!!T input) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst [mscorlib]System.String
IL_000b: ldnull
IL_000c: cgt.un
IL_000e: ret
} // end of method Generics::IsString
.method public hidebysig static string
AsString<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst [mscorlib]System.String
IL_000b: ret
} // end of method Generics::AsString
.method public hidebysig static string
CastToString<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: castclass [mscorlib]System.String
IL_000b: ret
} // end of method Generics::CastToString
.method public hidebysig static !!T CastFromString<T>(string input) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: unbox.any !!T
IL_0006: ret
} // end of method Generics::CastFromString
.method public hidebysig static bool IsInt<T>(!!T input) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst [mscorlib]System.Int32
IL_000b: ldnull
IL_000c: cgt.un
IL_000e: ret
} // end of method Generics::IsInt
.method public hidebysig static int32 CastToInt<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: unbox.any [mscorlib]System.Int32
IL_000b: ret
} // end of method Generics::CastToInt
.method public hidebysig static !!T CastFromInt<T>(int32 input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box [mscorlib]System.Int32
IL_0006: unbox.any !!T
IL_000b: ret
} // end of method Generics::CastFromInt
.method public hidebysig static bool IsNullableInt<T>(!!T input) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000b: ldnull
IL_000c: cgt.un
IL_000e: ret
} // end of method Generics::IsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
AsNullableInt<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000b: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_0010: ret
} // end of method Generics::AsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
CastToNullableInt<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_000b: ret
} // end of method Generics::CastToNullableInt
.method public hidebysig static !!T CastFromNullableInt<T>(valuetype [mscorlib]System.Nullable`1<int32> input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box valuetype [mscorlib]System.Nullable`1<int32>
IL_0006: unbox.any !!T
IL_000b: ret
} // end of method Generics::CastFromNullableInt
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -241,6 +608,32 @@ @@ -241,6 +608,32 @@
IL_0006: ret
} // end of method Generics::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 91 (0x5b)
.maxstack 1
IL_0000: ldtoken [mscorlib]System.Collections.Generic.List`1
IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_000a: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type1
IL_000f: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1
IL_0014: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0019: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type2
IL_001e: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_0023: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0028: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type3
IL_002d: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1
IL_0032: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0037: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type4
IL_003c: ldtoken class [mscorlib]System.Collections.Generic.List`1<int32>[]
IL_0041: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0046: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type5
IL_004b: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum
IL_0050: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0055: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type6
IL_005a: ret
} // end of method Generics::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics

399
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.roslyn.il

@ -126,6 +126,156 @@ @@ -126,6 +126,156 @@
} // end of class DerivedClass
.class auto ansi nested public beforefieldinit MyArray`1<T>
extends [mscorlib]System.Object
{
.class auto ansi nested public beforefieldinit NestedClass`1<T,Y>
extends [mscorlib]System.Object
{
.field public !T Item1
.field public !Y Item2
.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 NestedClass`1::.ctor
} // end of class NestedClass`1
.class auto ansi sealed nested public NestedEnum<T>
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> A = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> B = int32(0x00000001)
} // end of class NestedEnum
.field private !T[] arr
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 capacity) cil managed
{
// Code size 19 (0x13)
.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: newarr !T
IL_000d: stfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0012: ret
} // end of method MyArray`1::.ctor
.method public hidebysig instance void
Size(int32 capacity) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0006: ldarg.1
IL_0007: call void [mscorlib]System.Array::Resize<!T>(!!0[]&,
int32)
IL_000c: ret
} // end of method MyArray`1::Size
.method public hidebysig instance void
Grow(int32 capacity) cil managed
{
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.0
IL_0002: ldfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0007: ldlen
IL_0008: conv.i4
IL_0009: blt.s IL_0012
IL_000b: ldarg.0
IL_000c: ldarg.1
IL_000d: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::Size(int32)
IL_0012: ret
} // end of method MyArray`1::Grow
} // end of class MyArray`1
.class interface abstract auto ansi nested public IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method IInterface::Method1
.method public hidebysig newslot abstract virtual
instance void Method2<class T>() cil managed
{
} // end of method IInterface::Method2
} // end of class IInterface
.class abstract auto ansi nested public beforefieldinit Base
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method Base::Method1
.method private hidebysig newslot virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2<class T>() cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface::Method2
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Base::ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2
.method family 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 Base::.ctor
} // end of class Base
.class auto ansi nested public beforefieldinit Derived
extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base
{
.method public hidebysig virtual instance void
Method1<class T>() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Derived::Method1
.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 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base::.ctor()
IL_0006: ret
} // end of method Derived::.ctor
} // end of class Derived
.field private static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<string> enumVal = int32(0x00000000)
.field private static class [mscorlib]System.Type type1
.field private static class [mscorlib]System.Type type2
.field private static class [mscorlib]System.Type type3
.field private static class [mscorlib]System.Type type4
.field private static class [mscorlib]System.Type type5
.field private static class [mscorlib]System.Type type6
.method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed
{
// Code size 7 (0x7)
@ -256,17 +406,230 @@ @@ -256,17 +406,230 @@
IL_0007: ret
} // end of method Generics::NewArray
.method public hidebysig instance class [mscorlib]System.Type[]
TestTypeOf() cil managed
{
// Code size 111 (0x6f)
.maxstack 4
IL_0000: ldc.i4.8
IL_0001: newarr [mscorlib]System.Type
IL_0006: dup
IL_0007: ldc.i4.0
IL_0008: ldtoken [mscorlib]System.Int32
IL_000d: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0012: stelem.ref
IL_0013: dup
IL_0014: ldc.i4.1
IL_0015: ldtoken int32[]
IL_001a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_001f: stelem.ref
IL_0020: dup
IL_0021: ldc.i4.2
IL_0022: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1
IL_0027: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_002c: stelem.ref
IL_002d: dup
IL_002e: ldc.i4.3
IL_002f: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32>
IL_0034: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0039: stelem.ref
IL_003a: dup
IL_003b: ldc.i4.4
IL_003c: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32[]>
IL_0041: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0046: stelem.ref
IL_0047: dup
IL_0048: ldc.i4.5
IL_0049: ldtoken [mscorlib]System.Collections.Generic.Dictionary`2
IL_004e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0053: stelem.ref
IL_0054: dup
IL_0055: ldc.i4.6
IL_0056: ldtoken valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator<int32>
IL_005b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0060: stelem.ref
IL_0061: dup
IL_0062: ldc.i4.7
IL_0063: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_0068: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_006d: stelem.ref
IL_006e: ret
} // end of method Generics::TestTypeOf
.method public hidebysig static void MethodWithConstraint<class (!!S) T,.ctor ([mscorlib]System.ICloneable) S>() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Generics::MethodWithConstraint
.method public hidebysig static void MethodWithStructConstraint<valuetype .ctor ([mscorlib]System.ValueType) T>() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Generics::MethodWithStructConstraint
.method private hidebysig static void MultidimensionalArray<T>(!!T[0...,0...] 'array') cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: ldc.i4.0
IL_0003: ldarg.0
IL_0004: ldc.i4.0
IL_0005: ldc.i4.1
IL_0006: call instance !!T !!T[0...,0...]::Get(int32,
int32)
IL_000b: call instance void !!T[0...,0...]::Set(int32,
int32,
!!T)
IL_0010: ret
} // end of method Generics::MultidimensionalArray
.method public hidebysig static valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<string,string>
GetEnumerator(class [mscorlib]System.Collections.Generic.Dictionary`2<string,string> d,
class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1<string,int32> nc) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<string,string>::get_Keys()
IL_0006: callvirt instance valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<string,string>::GetEnumerator()
IL_000b: ret
} // end of method Generics::GetEnumerator
.method public hidebysig static bool IsString<T>(!!T input) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst [mscorlib]System.String
IL_000b: ldnull
IL_000c: cgt.un
IL_000e: ret
} // end of method Generics::IsString
.method public hidebysig static string
AsString<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst [mscorlib]System.String
IL_000b: ret
} // end of method Generics::AsString
.method public hidebysig static string
CastToString<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: castclass [mscorlib]System.String
IL_000b: ret
} // end of method Generics::CastToString
.method public hidebysig static !!T CastFromString<T>(string input) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: unbox.any !!T
IL_0006: ret
} // end of method Generics::CastFromString
.method public hidebysig static bool IsInt<T>(!!T input) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst [mscorlib]System.Int32
IL_000b: ldnull
IL_000c: cgt.un
IL_000e: ret
} // end of method Generics::IsInt
.method public hidebysig static int32 CastToInt<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: unbox.any [mscorlib]System.Int32
IL_000b: ret
} // end of method Generics::CastToInt
.method public hidebysig static !!T CastFromInt<T>(int32 input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box [mscorlib]System.Int32
IL_0006: unbox.any !!T
IL_000b: ret
} // end of method Generics::CastFromInt
.method public hidebysig static bool IsNullableInt<T>(!!T input) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000b: ldnull
IL_000c: cgt.un
IL_000e: ret
} // end of method Generics::IsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
AsNullableInt<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000b: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_0010: ret
} // end of method Generics::AsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
CastToNullableInt<T>(!!T input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_000b: ret
} // end of method Generics::CastToNullableInt
.method public hidebysig static !!T CastFromNullableInt<T>(valuetype [mscorlib]System.Nullable`1<int32> input) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box valuetype [mscorlib]System.Nullable`1<int32>
IL_0006: unbox.any !!T
IL_000b: ret
} // end of method Generics::CastFromNullableInt
.method public hidebysig static object
CallDelegate<([mscorlib]System.Delegate) T>(!!T input) cil managed
{
// Code size 18 (0x12)
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: box !!T
IL_0006: ldc.i4.0
IL_0007: newarr [mscorlib]System.Object
IL_000c: callvirt instance object [mscorlib]System.Delegate::DynamicInvoke(object[])
IL_0011: ret
IL_0006: call !!0[] [mscorlib]System.Array::Empty<object>()
IL_000b: callvirt instance object [mscorlib]System.Delegate::DynamicInvoke(object[])
IL_0010: ret
} // end of method Generics::CallDelegate
.method public hidebysig static int32 CountEnumerators<([mscorlib]System.Enum) T>() cil managed
@ -300,6 +663,32 @@ @@ -300,6 +663,32 @@
IL_0006: ret
} // end of method Generics::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 91 (0x5b)
.maxstack 1
IL_0000: ldtoken [mscorlib]System.Collections.Generic.List`1
IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_000a: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type1
IL_000f: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1
IL_0014: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0019: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type2
IL_001e: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_0023: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0028: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type3
IL_002d: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1
IL_0032: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0037: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type4
IL_003c: ldtoken class [mscorlib]System.Collections.Generic.List`1<int32>[]
IL_0041: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0046: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type5
IL_004b: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum
IL_0050: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0055: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type6
IL_005a: ret
} // end of method Generics::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics

507
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.roslyn.il

@ -132,6 +132,175 @@ @@ -132,6 +132,175 @@
} // end of class DerivedClass
.class auto ansi nested public beforefieldinit MyArray`1<T>
extends [mscorlib]System.Object
{
.class auto ansi nested public beforefieldinit NestedClass`1<T,Y>
extends [mscorlib]System.Object
{
.field public !T Item1
.field public !Y Item2
.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 NestedClass`1::.ctor
} // end of class NestedClass`1
.class auto ansi sealed nested public NestedEnum<T>
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> A = int32(0x00000000)
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<!T> B = int32(0x00000001)
} // end of class NestedEnum
.field private !T[] arr
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 capacity) cil managed
{
// Code size 21 (0x15)
.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: newarr !T
IL_000f: stfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0014: ret
} // end of method MyArray`1::.ctor
.method public hidebysig instance void
Size(int32 capacity) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldflda !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0007: ldarg.1
IL_0008: call void [mscorlib]System.Array::Resize<!T>(!!0[]&,
int32)
IL_000d: nop
IL_000e: ret
} // end of method MyArray`1::Size
.method public hidebysig instance void
Grow(int32 capacity) cil managed
{
// Code size 30 (0x1e)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.0
IL_0003: ldfld !0[] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::arr
IL_0008: ldlen
IL_0009: conv.i4
IL_000a: clt
IL_000c: ldc.i4.0
IL_000d: ceq
IL_000f: stloc.0
IL_0010: ldloc.0
IL_0011: brfalse.s IL_001d
IL_0013: nop
IL_0014: ldarg.0
IL_0015: ldarg.1
IL_0016: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1<!T>::Size(int32)
IL_001b: nop
IL_001c: nop
IL_001d: ret
} // end of method MyArray`1::Grow
} // end of class MyArray`1
.class interface abstract auto ansi nested public IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method IInterface::Method1
.method public hidebysig newslot abstract virtual
instance void Method2<class T>() cil managed
{
} // end of method IInterface::Method2
} // end of class IInterface
.class abstract auto ansi nested public beforefieldinit Base
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface
{
.method public hidebysig newslot abstract virtual
instance void Method1<class T>() cil managed
{
} // end of method Base::Method1
.method private hidebysig newslot virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2<class T>() cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/IInterface::Method2
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Base::ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics.IInterface.Method2
.method family 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 Base::.ctor
} // end of class Base
.class auto ansi nested public beforefieldinit Derived
extends ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base
{
.method public hidebysig virtual instance void
Method1<class T>() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Derived::Method1
.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 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/Base::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method Derived::.ctor
} // end of class Derived
.field private static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum<string> enumVal = int32(0x00000000)
.field private static class [mscorlib]System.Type type1
.field private static class [mscorlib]System.Type type2
.field private static class [mscorlib]System.Type type3
.field private static class [mscorlib]System.Type type4
.field private static class [mscorlib]System.Type type5
.field private static class [mscorlib]System.Type type6
.method public hidebysig instance !!T CastToTypeParameter<(ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/BaseClass) T>(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/DerivedClass d) cil managed
{
// Code size 12 (0xc)
@ -334,23 +503,317 @@ @@ -334,23 +503,317 @@
IL_000c: ret
} // end of method Generics::NewArray
.method public hidebysig instance class [mscorlib]System.Type[]
TestTypeOf() cil managed
{
// Code size 116 (0x74)
.maxstack 4
.locals init (class [mscorlib]System.Type[] V_0)
IL_0000: nop
IL_0001: ldc.i4.8
IL_0002: newarr [mscorlib]System.Type
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldtoken [mscorlib]System.Int32
IL_000e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0013: stelem.ref
IL_0014: dup
IL_0015: ldc.i4.1
IL_0016: ldtoken int32[]
IL_001b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0020: stelem.ref
IL_0021: dup
IL_0022: ldc.i4.2
IL_0023: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1
IL_0028: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_002d: stelem.ref
IL_002e: dup
IL_002f: ldc.i4.3
IL_0030: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32>
IL_0035: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_003a: stelem.ref
IL_003b: dup
IL_003c: ldc.i4.4
IL_003d: ldtoken class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/GenericClass`1<int32[]>
IL_0042: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0047: stelem.ref
IL_0048: dup
IL_0049: ldc.i4.5
IL_004a: ldtoken [mscorlib]System.Collections.Generic.Dictionary`2
IL_004f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0054: stelem.ref
IL_0055: dup
IL_0056: ldc.i4.6
IL_0057: ldtoken valuetype [mscorlib]System.Collections.Generic.List`1/Enumerator<int32>
IL_005c: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0061: stelem.ref
IL_0062: dup
IL_0063: ldc.i4.7
IL_0064: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_0069: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_006e: stelem.ref
IL_006f: stloc.0
IL_0070: br.s IL_0072
IL_0072: ldloc.0
IL_0073: ret
} // end of method Generics::TestTypeOf
.method public hidebysig static void MethodWithConstraint<class (!!S) T,.ctor ([mscorlib]System.ICloneable) S>() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Generics::MethodWithConstraint
.method public hidebysig static void MethodWithStructConstraint<valuetype .ctor ([mscorlib]System.ValueType) T>() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Generics::MethodWithStructConstraint
.method private hidebysig static void MultidimensionalArray<T>(!!T[0...,0...] 'array') cil managed
{
// Code size 18 (0x12)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.0
IL_0003: ldc.i4.0
IL_0004: ldarg.0
IL_0005: ldc.i4.0
IL_0006: ldc.i4.1
IL_0007: call instance !!T !!T[0...,0...]::Get(int32,
int32)
IL_000c: call instance void !!T[0...,0...]::Set(int32,
int32,
!!T)
IL_0011: ret
} // end of method Generics::MultidimensionalArray
.method public hidebysig static valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<string,string>
GetEnumerator(class [mscorlib]System.Collections.Generic.Dictionary`2<string,string> d,
class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1<string,int32> nc) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<string,string> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<string,string>::get_Keys()
IL_0007: callvirt instance valuetype [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection/Enumerator<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2/KeyCollection<string,string>::GetEnumerator()
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::GetEnumerator
.method public hidebysig static bool IsString<T>(!!T input) cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst [mscorlib]System.String
IL_000c: ldnull
IL_000d: cgt.un
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method Generics::IsString
.method public hidebysig static string
AsString<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst [mscorlib]System.String
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::AsString
.method public hidebysig static string
CastToString<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: castclass [mscorlib]System.String
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastToString
.method public hidebysig static !!T CastFromString<T>(string input) cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (!!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: unbox.any !!T
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method Generics::CastFromString
.method public hidebysig static bool IsInt<T>(!!T input) cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst [mscorlib]System.Int32
IL_000c: ldnull
IL_000d: cgt.un
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method Generics::IsInt
.method public hidebysig static int32 CastToInt<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: unbox.any [mscorlib]System.Int32
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastToInt
.method public hidebysig static !!T CastFromInt<T>(int32 input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (!!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box [mscorlib]System.Int32
IL_0007: unbox.any !!T
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastFromInt
.method public hidebysig static bool IsNullableInt<T>(!!T input) cil managed
{
// Code size 20 (0x14)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000c: ldnull
IL_000d: cgt.un
IL_000f: stloc.0
IL_0010: br.s IL_0012
IL_0012: ldloc.0
IL_0013: ret
} // end of method Generics::IsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
AsNullableInt<T>(!!T input) cil managed
{
// Code size 22 (0x16)
.maxstack 1
.locals init (valuetype [mscorlib]System.Nullable`1<int32> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: isinst valuetype [mscorlib]System.Nullable`1<int32>
IL_000c: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_0011: stloc.0
IL_0012: br.s IL_0014
IL_0014: ldloc.0
IL_0015: ret
} // end of method Generics::AsNullableInt
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<int32>
CastToNullableInt<T>(!!T input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype [mscorlib]System.Nullable`1<int32> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: unbox.any valuetype [mscorlib]System.Nullable`1<int32>
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastToNullableInt
.method public hidebysig static !!T CastFromNullableInt<T>(valuetype [mscorlib]System.Nullable`1<int32> input) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (!!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box valuetype [mscorlib]System.Nullable`1<int32>
IL_0007: unbox.any !!T
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method Generics::CastFromNullableInt
.method public hidebysig static object
CallDelegate<([mscorlib]System.Delegate) T>(!!T input) cil managed
{
// Code size 23 (0x17)
// Code size 22 (0x16)
.maxstack 2
.locals init (object V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: box !!T
IL_0007: ldc.i4.0
IL_0008: newarr [mscorlib]System.Object
IL_000d: callvirt instance object [mscorlib]System.Delegate::DynamicInvoke(object[])
IL_0012: stloc.0
IL_0013: br.s IL_0015
IL_0015: ldloc.0
IL_0016: ret
IL_0007: call !!0[] [mscorlib]System.Array::Empty<object>()
IL_000c: callvirt instance object [mscorlib]System.Delegate::DynamicInvoke(object[])
IL_0011: stloc.0
IL_0012: br.s IL_0014
IL_0014: ldloc.0
IL_0015: ret
} // end of method Generics::CallDelegate
.method public hidebysig static int32 CountEnumerators<([mscorlib]System.Enum) T>() cil managed
@ -397,6 +860,32 @@ @@ -397,6 +860,32 @@
IL_0007: ret
} // end of method Generics::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 91 (0x5b)
.maxstack 1
IL_0000: ldtoken [mscorlib]System.Collections.Generic.List`1
IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_000a: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type1
IL_000f: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1
IL_0014: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0019: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type2
IL_001e: ldtoken [mscorlib]System.Collections.Generic.List`1/Enumerator
IL_0023: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0028: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type3
IL_002d: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedClass`1
IL_0032: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0037: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type4
IL_003c: ldtoken class [mscorlib]System.Collections.Generic.List`1<int32>[]
IL_0041: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0046: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type5
IL_004b: ldtoken ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics/MyArray`1/NestedEnum
IL_0050: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0055: stsfld class [mscorlib]System.Type ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics::type6
IL_005a: ret
} // end of method Generics::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Generics

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

@ -430,6 +430,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests @@ -430,6 +430,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
1
}
};
#if ROSLYN
public static ReadOnlySpan<byte> StaticData1 => new byte[1] {
0
};
public static ReadOnlySpan<byte> StaticData3 => new byte[3] {
1,
2,
3
};
public static Span<byte> StaticData3Span => new byte[3] {
1,
2,
3
};
#endif
#endregion
#region Helper methods used to ensure initializers used within expressions work correctly
@ -1123,21 +1141,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests @@ -1123,21 +1141,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
public static byte[] ReverseInitializer(int i)
{
#if ROSLYN && OPT
byte[] obj = new byte[4];
obj[3] = (byte)i;
obj[2] = (byte)(i >> 8);
obj[1] = (byte)(i >> 16);
obj[0] = (byte)(i >> 24);
return obj;
#else
byte[] array = new byte[4];
array[3] = (byte)i;
array[2] = (byte)(i >> 8);
array[1] = (byte)(i >> 16);
array[0] = (byte)(i >> 24);
return array;
#endif
}
public static void Issue953_MissingNullableSpecifierForArrayInitializer()

191
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.roslyn.il

@ -8,6 +8,11 @@ @@ -8,6 +8,11 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern System.Memory
{
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) // .{...-.Q
.ver 4:0:1:0
}
.assembly extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
@ -1200,8 +1205,8 @@ @@ -1200,8 +1205,8 @@
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__65_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__79_0'
.field public static class [mscorlib]System.EventHandler '<>9__71_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__85_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -1223,17 +1228,17 @@ @@ -1223,17 +1228,17 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__65_0'(object '<p0>',
'<NotAnObjectInitializerWithEvent>b__71_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: call void [mscorlib]System.Console::WriteLine()
IL_0005: ret
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__71_0'
.method assembly hidebysig instance bool
'<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
'<Issue270_NestedInitialisers>b__85_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{
// Code size 17 (0x11)
.maxstack 8
@ -1243,7 +1248,7 @@ @@ -1243,7 +1248,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0010: ret
} // end of method '<>c'::'<Issue270_NestedInitialisers>b__79_0'
} // end of method '<>c'::'<Issue270_NestedInitialisers>b__85_0'
} // end of class '<>c'
@ -1253,6 +1258,48 @@ @@ -1253,6 +1258,48 @@
.field private static class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/V3f[][0...,0...] Issue1336_rg1c
.field private static class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/V3f[0...,0...][] Issue1336_rg1d
.field private static int32[0...,0...] Issue1336_rg2
.method public hidebysig specialname static
valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
get_StaticData1() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldsflda uint8 '<PrivateImplementationDetails>'::'5BA93C9DB0CFF93F52B521D7420E43F6EDA2784F'
IL_0005: ldc.i4.1
IL_0006: newobj instance void valuetype [System.Memory]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_000b: ret
} // end of method TestCases::get_StaticData1
.method public hidebysig specialname static
valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
get_StaticData3() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldsflda valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=3' '<PrivateImplementationDetails>'::'7037807198C22A7D2B0807371D763779A84FDFCF'
IL_0005: ldc.i4.3
IL_0006: newobj instance void valuetype [System.Memory]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_000b: ret
} // end of method TestCases::get_StaticData3
.method public hidebysig specialname static
valuetype [System.Memory]System.Span`1<uint8>
get_StaticData3Span() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: ldc.i4.3
IL_0001: newarr [mscorlib]System.Byte
IL_0006: dup
IL_0007: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=3' '<PrivateImplementationDetails>'::'7037807198C22A7D2B0807371D763779A84FDFCF'
IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0011: call valuetype [System.Memory]System.Span`1<!0> valuetype [System.Memory]System.Span`1<uint8>::op_Implicit(!0[])
IL_0016: ret
} // end of method TestCases::get_StaticData3Span
.method private hidebysig static void X(object a,
object b) cil managed
{
@ -2507,18 +2554,18 @@ @@ -2507,18 +2554,18 @@
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::.ctor()
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_0007: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__71_0'
IL_000c: dup
IL_000d: brtrue.s IL_0026
IL_000f: pop
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'(object,
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__71_0'(object,
class [mscorlib]System.EventArgs)
IL_001b: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int)
IL_0020: dup
IL_0021: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_0021: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__71_0'
IL_0026: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::add_TestEvent(class [mscorlib]System.EventHandler)
IL_002b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0030: ldloc.0
@ -2855,17 +2902,17 @@ @@ -2855,17 +2902,17 @@
IL_0033: callvirt instance void [mscorlib]System.Globalization.CultureInfo::set_DateTimeFormat(class [mscorlib]System.Globalization.DateTimeFormatInfo)
IL_0038: dup
IL_0039: ldloc.0
IL_003a: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_003a: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__85_0'
IL_003f: dup
IL_0040: brtrue.s IL_0059
IL_0042: pop
IL_0043: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__85_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_004e: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object,
native int)
IL_0053: dup
IL_0054: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_0054: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__85_0'
IL_0059: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0> [System.Core]System.Linq.Enumerable::Where<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
class [mscorlib]System.Func`2<!!0,bool>)
IL_005e: call !!0 [System.Core]System.Linq.Enumerable::First<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
@ -4235,12 +4282,34 @@ @@ -4235,12 +4282,34 @@
IL_0772: ret
} // end of method TestCases::.cctor
.property valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
StaticData1()
{
.get valuetype [System.Memory]System.ReadOnlySpan`1<uint8> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::get_StaticData1()
} // end of property TestCases::StaticData1
.property valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
StaticData3()
{
.get valuetype [System.Memory]System.ReadOnlySpan`1<uint8> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::get_StaticData3()
} // end of property TestCases::StaticData3
.property valuetype [System.Memory]System.Span`1<uint8>
StaticData3Span()
{
.get valuetype [System.Memory]System.Span`1<uint8> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::get_StaticData3Span()
} // end of property TestCases::StaticData3Span
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
.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=3'
extends [mscorlib]System.ValueType
{
.pack 1
.size 3
} // end of class '__StaticArrayInitTypeSize=3'
.class explicit ansi sealed nested private '__StaticArrayInitTypeSize=10'
extends [mscorlib]System.ValueType
{
@ -4311,68 +4380,76 @@ @@ -4311,68 +4380,76 @@
.size 256
} // end of class '__StaticArrayInitTypeSize=256'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007040
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_00007088
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_00007098
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_000070E0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_000070F0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007100
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007140
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_00007168
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000071B8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000072B8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_000072C0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_000072E8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007310
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007328
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007330
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_00007360
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000073A0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_000073C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_000073D0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_000073F8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007240
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_00007288
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_00007298
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_000072E0
.field static assembly initonly uint8 '5BA93C9DB0CFF93F52B521D7420E43F6EDA2784F' at I_000072F0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=3' '7037807198C22A7D2B0807371D763779A84FDFCF' at I_000072F8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_00007300
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007310
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007350
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_00007378
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000073C8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000074C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_000074D0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_000074F8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007520
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007538
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007540
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_00007570
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000075B0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_000075D8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_000075E0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00007608
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_00007040 = bytearray (
.data cil I_00007240 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00)
.data cil I_00007088 = bytearray (
.data cil I_00007288 = bytearray (
01 02 03 04 05 06 07 08 FE FF)
.data cil I_00007092 = int8[6]
.data cil I_00007098 = bytearray (
.data cil I_00007292 = int8[6]
.data cil I_00007298 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'...
.data cil I_000070E0 = bytearray (
.data cil I_000072E0 = bytearray (
00 80 FF FF 00 00 01 00 FF 7F)
.data cil I_000070EA = int8[6]
.data cil I_000070F0 = bytearray (
.data cil I_000072EA = int8[6]
.data cil I_000072F0 = bytearray (
00)
.data cil I_000072F1 = int8[7]
.data cil I_000072F8 = bytearray (
01 02 03)
.data cil I_000072FB = int8[5]
.data cil I_00007300 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_000070FC = int8[4]
.data cil I_00007100 = bytearray (
.data cil I_0000730C = int8[4]
.data cil I_00007310 = bytearray (
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_00007140 = bytearray (
.data cil I_00007350 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_00007168 = bytearray (
.data cil I_00007378 = bytearray (
01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_000071B8 = bytearray (
.data cil I_000073C8 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4389,43 +4466,43 @@ @@ -4389,43 +4466,43 @@
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_000072B8 = bytearray (
.data cil I_000074C8 = bytearray (
80 81 00 01 02 03 04 7F)
.data cil I_000072C0 = bytearray (
.data cil I_000074D0 = bytearray (
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00)
.data cil I_000072E4 = int8[4]
.data cil I_000072E8 = bytearray (
.data cil I_000074F4 = int8[4]
.data cil I_000074F8 = bytearray (
01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007310 = bytearray (
.data cil I_00007520 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00)
.data cil I_00007328 = bytearray (
.data cil I_00007538 = bytearray (
00 01 02 FF)
.data cil I_0000732C = int8[4]
.data cil I_00007330 = bytearray (
.data cil I_0000753C = int8[4]
.data cil I_00007540 = bytearray (
00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00
00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_00007360 = bytearray (
.data cil I_00007570 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_000073A0 = bytearray (
.data cil I_000075B0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_000073C8 = bytearray (
.data cil I_000075D8 = bytearray (
01 00 01 00 00 00 01 01)
.data cil I_000073D0 = bytearray (
.data cil I_000075E0 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_000073F8 = bytearray (
.data cil I_00007608 = bytearray (
00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?....
00 00 80 7F 00 00 C0 FF)
// *********** DISASSEMBLY COMPLETE ***********************

191
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.roslyn.il

@ -8,6 +8,11 @@ @@ -8,6 +8,11 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly extern System.Memory
{
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) // .{...-.Q
.ver 4:0:1:0
}
.assembly extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
@ -1270,8 +1275,8 @@ @@ -1270,8 +1275,8 @@
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__65_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__79_0'
.field public static class [mscorlib]System.EventHandler '<>9__71_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__85_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -1294,7 +1299,7 @@ @@ -1294,7 +1299,7 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__65_0'(object '<p0>',
'<NotAnObjectInitializerWithEvent>b__71_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 8 (0x8)
@ -1303,10 +1308,10 @@ @@ -1303,10 +1308,10 @@
IL_0001: call void [mscorlib]System.Console::WriteLine()
IL_0006: nop
IL_0007: ret
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__71_0'
.method assembly hidebysig instance bool
'<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
'<Issue270_NestedInitialisers>b__85_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{
// Code size 17 (0x11)
.maxstack 8
@ -1316,7 +1321,7 @@ @@ -1316,7 +1321,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0010: ret
} // end of method '<>c'::'<Issue270_NestedInitialisers>b__79_0'
} // end of method '<>c'::'<Issue270_NestedInitialisers>b__85_0'
} // end of class '<>c'
@ -1326,6 +1331,48 @@ @@ -1326,6 +1331,48 @@
.field private static class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/V3f[][0...,0...] Issue1336_rg1c
.field private static class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/V3f[0...,0...][] Issue1336_rg1d
.field private static int32[0...,0...] Issue1336_rg2
.method public hidebysig specialname static
valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
get_StaticData1() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldsflda uint8 '<PrivateImplementationDetails>'::'5BA93C9DB0CFF93F52B521D7420E43F6EDA2784F'
IL_0005: ldc.i4.1
IL_0006: newobj instance void valuetype [System.Memory]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_000b: ret
} // end of method TestCases::get_StaticData1
.method public hidebysig specialname static
valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
get_StaticData3() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldsflda valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=3' '<PrivateImplementationDetails>'::'7037807198C22A7D2B0807371D763779A84FDFCF'
IL_0005: ldc.i4.3
IL_0006: newobj instance void valuetype [System.Memory]System.ReadOnlySpan`1<uint8>::.ctor(void*,
int32)
IL_000b: ret
} // end of method TestCases::get_StaticData3
.method public hidebysig specialname static
valuetype [System.Memory]System.Span`1<uint8>
get_StaticData3Span() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: ldc.i4.3
IL_0001: newarr [mscorlib]System.Byte
IL_0006: dup
IL_0007: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=3' '<PrivateImplementationDetails>'::'7037807198C22A7D2B0807371D763779A84FDFCF'
IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0011: call valuetype [System.Memory]System.Span`1<!0> valuetype [System.Memory]System.Span`1<uint8>::op_Implicit(!0[])
IL_0016: ret
} // end of method TestCases::get_StaticData3Span
.method private hidebysig static void X(object a,
object b) cil managed
{
@ -2760,18 +2807,18 @@ @@ -2760,18 +2807,18 @@
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::.ctor()
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_0008: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__71_0'
IL_000d: dup
IL_000e: brtrue.s IL_0027
IL_0010: pop
IL_0011: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_0016: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'(object,
IL_0016: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__71_0'(object,
class [mscorlib]System.EventArgs)
IL_001c: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int)
IL_0021: dup
IL_0022: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_0022: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__71_0'
IL_0027: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::add_TestEvent(class [mscorlib]System.EventHandler)
IL_002c: nop
IL_002d: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
@ -3171,17 +3218,17 @@ @@ -3171,17 +3218,17 @@
IL_003b: nop
IL_003c: dup
IL_003d: ldloc.0
IL_003e: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_003e: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__85_0'
IL_0043: dup
IL_0044: brtrue.s IL_005d
IL_0046: pop
IL_0047: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__85_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_0052: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object,
native int)
IL_0057: dup
IL_0058: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_0058: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__85_0'
IL_005d: call class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0> [System.Core]System.Linq.Enumerable::Where<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
class [mscorlib]System.Func`2<!!0,bool>)
IL_0062: call !!0 [System.Core]System.Linq.Enumerable::First<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
@ -4699,12 +4746,34 @@ @@ -4699,12 +4746,34 @@
IL_0772: ret
} // end of method TestCases::.cctor
.property valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
StaticData1()
{
.get valuetype [System.Memory]System.ReadOnlySpan`1<uint8> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::get_StaticData1()
} // end of property TestCases::StaticData1
.property valuetype [System.Memory]System.ReadOnlySpan`1<uint8>
StaticData3()
{
.get valuetype [System.Memory]System.ReadOnlySpan`1<uint8> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::get_StaticData3()
} // end of property TestCases::StaticData3
.property valuetype [System.Memory]System.Span`1<uint8>
StaticData3Span()
{
.get valuetype [System.Memory]System.Span`1<uint8> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::get_StaticData3Span()
} // end of property TestCases::StaticData3Span
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
.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=3'
extends [mscorlib]System.ValueType
{
.pack 1
.size 3
} // end of class '__StaticArrayInitTypeSize=3'
.class explicit ansi sealed nested private '__StaticArrayInitTypeSize=10'
extends [mscorlib]System.ValueType
{
@ -4775,68 +4844,76 @@ @@ -4775,68 +4844,76 @@
.size 256
} // end of class '__StaticArrayInitTypeSize=256'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007480
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_000074C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_000074D8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_00007520
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_00007530
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007540
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007580
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_000075A8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000075F8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000076F8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_00007700
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_00007728
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007750
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007768
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007770
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_000077A0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000077E0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_00007808
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_00007810
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00007838
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007680
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_000076C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_000076D8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_00007720
.field static assembly initonly uint8 '5BA93C9DB0CFF93F52B521D7420E43F6EDA2784F' at I_00007730
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=3' '7037807198C22A7D2B0807371D763779A84FDFCF' at I_00007738
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_00007740
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007750
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007790
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_000077B8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_00007808
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_00007908
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_00007910
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_00007938
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007960
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007978
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007980
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_000079B0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000079F0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_00007A18
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_00007A20
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00007A48
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_00007480 = bytearray (
.data cil I_00007680 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00)
.data cil I_000074C8 = bytearray (
.data cil I_000076C8 = bytearray (
01 02 03 04 05 06 07 08 FE FF)
.data cil I_000074D2 = int8[6]
.data cil I_000074D8 = bytearray (
.data cil I_000076D2 = int8[6]
.data cil I_000076D8 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'...
.data cil I_00007520 = bytearray (
.data cil I_00007720 = bytearray (
00 80 FF FF 00 00 01 00 FF 7F)
.data cil I_0000752A = int8[6]
.data cil I_00007530 = bytearray (
.data cil I_0000772A = int8[6]
.data cil I_00007730 = bytearray (
00)
.data cil I_00007731 = int8[7]
.data cil I_00007738 = bytearray (
01 02 03)
.data cil I_0000773B = int8[5]
.data cil I_00007740 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_0000753C = int8[4]
.data cil I_00007540 = bytearray (
.data cil I_0000774C = int8[4]
.data cil I_00007750 = bytearray (
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_00007580 = bytearray (
.data cil I_00007790 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_000075A8 = bytearray (
.data cil I_000077B8 = bytearray (
01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_000075F8 = bytearray (
.data cil I_00007808 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4853,43 +4930,43 @@ @@ -4853,43 +4930,43 @@
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_000076F8 = bytearray (
.data cil I_00007908 = bytearray (
80 81 00 01 02 03 04 7F)
.data cil I_00007700 = bytearray (
.data cil I_00007910 = bytearray (
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00)
.data cil I_00007724 = int8[4]
.data cil I_00007728 = bytearray (
.data cil I_00007934 = int8[4]
.data cil I_00007938 = bytearray (
01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007750 = bytearray (
.data cil I_00007960 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00)
.data cil I_00007768 = bytearray (
.data cil I_00007978 = bytearray (
00 01 02 FF)
.data cil I_0000776C = int8[4]
.data cil I_00007770 = bytearray (
.data cil I_0000797C = int8[4]
.data cil I_00007980 = bytearray (
00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00
00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_000077A0 = bytearray (
.data cil I_000079B0 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_000077E0 = bytearray (
.data cil I_000079F0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007808 = bytearray (
.data cil I_00007A18 = bytearray (
01 00 01 00 00 00 01 01)
.data cil I_00007810 = bytearray (
.data cil I_00007A20 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007838 = bytearray (
.data cil I_00007A48 = bytearray (
00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?....
00 00 80 7F 00 00 C0 FF)
// *********** DISASSEMBLY COMPLETE ***********************

17
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeTests.cs → ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.cs

@ -16,20 +16,21 @@ @@ -16,20 +16,21 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class TypeTests
internal class InterfaceTests
{
[Flags]
public enum NegativeValueWithFlags
public interface IA
{
}
public interface IA2 : IA
{
}
public interface IB
{
Value = -2147483647
}
public enum NegativeValueWithoutFlags
public class C : IA2, IA, IB
{
Value = -2147483647
}
}
}

48
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeTests.opt.il → ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.il

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly TypeTests.opt
.assembly InterfaceTests
{
.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
@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module TypeTests.opt.dll
.module InterfaceTests.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
@ -29,23 +29,39 @@ @@ -29,23 +29,39 @@
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
} // end of class IA
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.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::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
@ -55,9 +71,9 @@ @@ -55,9 +71,9 @@
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method TypeTests::.ctor
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================

48
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeTests.il → ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.il

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly TypeTests
.assembly InterfaceTests.opt
{
.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
@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module TypeTests.dll
.module InterfaceTests.opt.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
@ -29,23 +29,39 @@ @@ -29,23 +29,39 @@
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
} // end of class IA
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.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::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
@ -55,9 +71,9 @@ @@ -55,9 +71,9 @@
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method TypeTests::.ctor
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================

48
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeTests.opt.roslyn.il → ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.opt.roslyn.il

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly TypeTests
.assembly InterfaceTests
{
.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
@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module TypeTests.dll
.module InterfaceTests.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
@ -33,23 +33,39 @@ @@ -33,23 +33,39 @@
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
} // end of class IA
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.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::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
@ -59,9 +75,9 @@ @@ -59,9 +75,9 @@
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method TypeTests::.ctor
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================

49
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeTests.roslyn.il → ICSharpCode.Decompiler.Tests/TestCases/Pretty/InterfaceTests.roslyn.il

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly TypeTests
.assembly InterfaceTests
{
.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
@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module TypeTests.dll
.module InterfaceTests.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
@ -33,23 +33,40 @@ @@ -33,23 +33,40 @@
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
extends [mscorlib]System.Object
{
.class auto ansi sealed nested public NegativeValueWithFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA
{
.custom instance void [mscorlib]System.FlagsAttribute::.ctor() = ( 01 00 00 00 )
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithFlags Value = int32(0x80000001)
} // end of class NegativeValueWithFlags
} // end of class IA
.class auto ansi sealed nested public NegativeValueWithoutFlags
extends [mscorlib]System.Enum
.class interface abstract auto ansi nested public IA2
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests/NegativeValueWithoutFlags Value = int32(0x80000001)
} // end of class NegativeValueWithoutFlags
} // end of class IA2
.class interface abstract auto ansi nested public IB
{
} // end of class IB
.class auto ansi nested public beforefieldinit C
extends [mscorlib]System.Object
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA2,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IA,
ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests/IB
{
.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::.ctor
} // end of class C
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
@ -60,9 +77,9 @@ @@ -60,9 +77,9 @@
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method TypeTests::.ctor
} // end of method InterfaceTests::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeTests
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InterfaceTests
// =============================================================

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

@ -27,11 +27,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -27,11 +27,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public class IndexerNonDefaultName
{
[IndexerName("Foo")]
#if ROSLYN
public int this[int index] => 0;
#else
public int this[int index] {
get {
return 0;
}
}
#endif
}
[DefaultMember("Bar")]

56
ICSharpCode.Decompiler.Tests/MultidimensionalArray.cs → ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.cs

@ -16,43 +16,41 @@ @@ -16,43 +16,41 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
public class MultidimensionalArray
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class Generic<T, S> where T : new()
public class MultidimensionalArray
{
private T[,] a = new T[20, 20];
private S[,][] b = new S[20, 20][];
public T this[int i, int j]
internal class Generic<T, S> where T : new()
{
get
private T[,] a = new T[20, 20];
private S[,][] b = new S[20, 20][];
public T this[int i, int j] {
get {
return a[i, j];
}
set {
a[i, j] = value;
}
}
public void TestB(S x, ref S y)
{
return this.a[i, j];
b[5, 3] = new S[10];
b[5, 3][0] = default(S);
b[5, 3][1] = x;
b[5, 3][2] = y;
}
set
public void PassByReference(ref T arr)
{
this.a[i, j] = value;
PassByReference(ref a[10, 10]);
}
}
public void TestB(S x, ref S y)
{
this.b[5, 3] = new S[10];
this.b[5, 3][0] = default(S);
this.b[5, 3][1] = x;
this.b[5, 3][2] = y;
}
public void PassByReference(ref T arr)
public int[][,] MakeArray()
{
this.PassByReference(ref this.a[10, 10]);
return new int[10][,];
}
}
public int[][,] MakeArray()
{
return new int[10][,];
}
}
}

214
ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.il

@ -0,0 +1,214 @@ @@ -0,0 +1,214 @@
// 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 MultidimensionalArray
{
.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.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module MultidimensionalArray.dll
.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.Pretty.MultidimensionalArray
extends [mscorlib]System.Object
{
.class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S>
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item..
.field private !T[0...,0...] a
.field private !S[][0...,0...] b
.method public hidebysig specialname
instance !T get_Item(int32 i,
int32 j) cil managed
{
// Code size 19 (0x13)
.maxstack 3
.locals init (!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0007: ldarg.1
IL_0008: ldarg.2
IL_0009: call instance !T !T[0...,0...]::Get(int32,
int32)
IL_000e: stloc.0
IL_000f: br.s IL_0011
IL_0011: ldloc.0
IL_0012: ret
} // end of method Generic`2::get_Item
.method public hidebysig specialname
instance void set_Item(int32 i,
int32 j,
!T 'value') cil managed
{
// Code size 16 (0x10)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0007: ldarg.1
IL_0008: ldarg.2
IL_0009: ldarg.3
IL_000a: call instance void !T[0...,0...]::Set(int32,
int32,
!T)
IL_000f: ret
} // end of method Generic`2::set_Item
.method public hidebysig instance void
TestB(!S x,
!S& y) cil managed
{
// Code size 95 (0x5f)
.maxstack 4
.locals init (!S V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0007: ldc.i4.5
IL_0008: ldc.i4.3
IL_0009: ldc.i4.s 10
IL_000b: newarr !S
IL_0010: call instance void !S[][0...,0...]::Set(int32,
int32,
!S[])
IL_0015: ldarg.0
IL_0016: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001b: ldc.i4.5
IL_001c: ldc.i4.3
IL_001d: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0022: ldc.i4.0
IL_0023: ldloca.s V_0
IL_0025: initobj !S
IL_002b: ldloc.0
IL_002c: stelem !S
IL_0031: ldarg.0
IL_0032: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0037: ldc.i4.5
IL_0038: ldc.i4.3
IL_0039: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_003e: ldc.i4.1
IL_003f: ldarg.1
IL_0040: stelem !S
IL_0045: ldarg.0
IL_0046: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_004b: ldc.i4.5
IL_004c: ldc.i4.3
IL_004d: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0052: ldc.i4.2
IL_0053: ldarg.2
IL_0054: ldobj !S
IL_0059: stelem !S
IL_005e: ret
} // end of method Generic`2::TestB
.method public hidebysig instance void
PassByReference(!T& arr) cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.0
IL_0003: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0008: ldc.i4.s 10
IL_000a: ldc.i4.s 10
IL_000c: call instance !T& !T[0...,0...]::Address(int32,
int32)
IL_0011: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::PassByReference(!0&)
IL_0016: nop
IL_0017: ret
} // end of method Generic`2::PassByReference
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 38 (0x26)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.s 20
IL_0003: ldc.i4.s 20
IL_0005: newobj instance void !T[0...,0...]::.ctor(int32,
int32)
IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_000f: ldarg.0
IL_0010: ldc.i4.s 20
IL_0012: ldc.i4.s 20
IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32,
int32)
IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001e: ldarg.0
IL_001f: call instance void [mscorlib]System.Object::.ctor()
IL_0024: nop
IL_0025: ret
} // end of method Generic`2::.ctor
.property instance !T Item(int32,
int32)
{
.get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32,
int32)
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32,
int32,
!T)
} // end of property Generic`2::Item
} // end of class Generic`2
.method public hidebysig instance int32[0...,0...][]
MakeArray() cil managed
{
// Code size 13 (0xd)
.maxstack 1
.locals init (int32[0...,0...][] V_0)
IL_0000: nop
IL_0001: ldc.i4.s 10
IL_0003: newarr int32[0...,0...]
IL_0008: stloc.0
IL_0009: br.s IL_000b
IL_000b: ldloc.0
IL_000c: ret
} // end of method MultidimensionalArray::MakeArray
.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 MultidimensionalArray::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

197
ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.il

@ -0,0 +1,197 @@ @@ -0,0 +1,197 @@
// 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 MultidimensionalArray.opt
{
.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.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module MultidimensionalArray.opt.dll
.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.Pretty.MultidimensionalArray
extends [mscorlib]System.Object
{
.class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S>
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item..
.field private !T[0...,0...] a
.field private !S[][0...,0...] b
.method public hidebysig specialname
instance !T get_Item(int32 i,
int32 j) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0006: ldarg.1
IL_0007: ldarg.2
IL_0008: call instance !T !T[0...,0...]::Get(int32,
int32)
IL_000d: ret
} // end of method Generic`2::get_Item
.method public hidebysig specialname
instance void set_Item(int32 i,
int32 j,
!T 'value') cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0006: ldarg.1
IL_0007: ldarg.2
IL_0008: ldarg.3
IL_0009: call instance void !T[0...,0...]::Set(int32,
int32,
!T)
IL_000e: ret
} // end of method Generic`2::set_Item
.method public hidebysig instance void
TestB(!S x,
!S& y) cil managed
{
// Code size 94 (0x5e)
.maxstack 4
.locals init (!S V_0)
IL_0000: ldarg.0
IL_0001: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0006: ldc.i4.5
IL_0007: ldc.i4.3
IL_0008: ldc.i4.s 10
IL_000a: newarr !S
IL_000f: call instance void !S[][0...,0...]::Set(int32,
int32,
!S[])
IL_0014: ldarg.0
IL_0015: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001a: ldc.i4.5
IL_001b: ldc.i4.3
IL_001c: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0021: ldc.i4.0
IL_0022: ldloca.s V_0
IL_0024: initobj !S
IL_002a: ldloc.0
IL_002b: stelem !S
IL_0030: ldarg.0
IL_0031: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0036: ldc.i4.5
IL_0037: ldc.i4.3
IL_0038: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_003d: ldc.i4.1
IL_003e: ldarg.1
IL_003f: stelem !S
IL_0044: ldarg.0
IL_0045: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_004a: ldc.i4.5
IL_004b: ldc.i4.3
IL_004c: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0051: ldc.i4.2
IL_0052: ldarg.2
IL_0053: ldobj !S
IL_0058: stelem !S
IL_005d: ret
} // end of method Generic`2::TestB
.method public hidebysig instance void
PassByReference(!T& arr) cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0007: ldc.i4.s 10
IL_0009: ldc.i4.s 10
IL_000b: call instance !T& !T[0...,0...]::Address(int32,
int32)
IL_0010: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::PassByReference(!0&)
IL_0015: ret
} // end of method Generic`2::PassByReference
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 37 (0x25)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.s 20
IL_0003: ldc.i4.s 20
IL_0005: newobj instance void !T[0...,0...]::.ctor(int32,
int32)
IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_000f: ldarg.0
IL_0010: ldc.i4.s 20
IL_0012: ldc.i4.s 20
IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32,
int32)
IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001e: ldarg.0
IL_001f: call instance void [mscorlib]System.Object::.ctor()
IL_0024: ret
} // end of method Generic`2::.ctor
.property instance !T Item(int32,
int32)
{
.get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32,
int32)
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32,
int32,
!T)
} // end of property Generic`2::Item
} // end of class Generic`2
.method public hidebysig instance int32[0...,0...][]
MakeArray() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.s 10
IL_0002: newarr int32[0...,0...]
IL_0007: ret
} // end of method MultidimensionalArray::MakeArray
.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 MultidimensionalArray::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

201
ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.roslyn.il

@ -0,0 +1,201 @@ @@ -0,0 +1,201 @@
// 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 MultidimensionalArray
{
.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 MultidimensionalArray.dll
.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.Pretty.MultidimensionalArray
extends [mscorlib]System.Object
{
.class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S>
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item..
.field private !T[0...,0...] a
.field private !S[][0...,0...] b
.method public hidebysig specialname
instance !T get_Item(int32 i,
int32 j) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0006: ldarg.1
IL_0007: ldarg.2
IL_0008: call instance !T !T[0...,0...]::Get(int32,
int32)
IL_000d: ret
} // end of method Generic`2::get_Item
.method public hidebysig specialname
instance void set_Item(int32 i,
int32 j,
!T 'value') cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0006: ldarg.1
IL_0007: ldarg.2
IL_0008: ldarg.3
IL_0009: call instance void !T[0...,0...]::Set(int32,
int32,
!T)
IL_000e: ret
} // end of method Generic`2::set_Item
.method public hidebysig instance void
TestB(!S x,
!S& y) cil managed
{
// Code size 94 (0x5e)
.maxstack 4
.locals init (!S V_0)
IL_0000: ldarg.0
IL_0001: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0006: ldc.i4.5
IL_0007: ldc.i4.3
IL_0008: ldc.i4.s 10
IL_000a: newarr !S
IL_000f: call instance void !S[][0...,0...]::Set(int32,
int32,
!S[])
IL_0014: ldarg.0
IL_0015: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001a: ldc.i4.5
IL_001b: ldc.i4.3
IL_001c: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0021: ldc.i4.0
IL_0022: ldloca.s V_0
IL_0024: initobj !S
IL_002a: ldloc.0
IL_002b: stelem !S
IL_0030: ldarg.0
IL_0031: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0036: ldc.i4.5
IL_0037: ldc.i4.3
IL_0038: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_003d: ldc.i4.1
IL_003e: ldarg.1
IL_003f: stelem !S
IL_0044: ldarg.0
IL_0045: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_004a: ldc.i4.5
IL_004b: ldc.i4.3
IL_004c: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0051: ldc.i4.2
IL_0052: ldarg.2
IL_0053: ldobj !S
IL_0058: stelem !S
IL_005d: ret
} // end of method Generic`2::TestB
.method public hidebysig instance void
PassByReference(!T& arr) cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.0
IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0007: ldc.i4.s 10
IL_0009: ldc.i4.s 10
IL_000b: call instance !T& !T[0...,0...]::Address(int32,
int32)
IL_0010: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::PassByReference(!0&)
IL_0015: ret
} // end of method Generic`2::PassByReference
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 37 (0x25)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.s 20
IL_0003: ldc.i4.s 20
IL_0005: newobj instance void !T[0...,0...]::.ctor(int32,
int32)
IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_000f: ldarg.0
IL_0010: ldc.i4.s 20
IL_0012: ldc.i4.s 20
IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32,
int32)
IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001e: ldarg.0
IL_001f: call instance void [mscorlib]System.Object::.ctor()
IL_0024: ret
} // end of method Generic`2::.ctor
.property instance !T Item(int32,
int32)
{
.get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32,
int32)
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32,
int32,
!T)
} // end of property Generic`2::Item
} // end of class Generic`2
.method public hidebysig instance int32[0...,0...][]
MakeArray() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.s 10
IL_0002: newarr int32[0...,0...]
IL_0007: ret
} // end of method MultidimensionalArray::MakeArray
.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 MultidimensionalArray::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

219
ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.roslyn.il

@ -0,0 +1,219 @@ @@ -0,0 +1,219 @@
// 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 MultidimensionalArray
{
.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 MultidimensionalArray.dll
.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.Pretty.MultidimensionalArray
extends [mscorlib]System.Object
{
.class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S>
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item..
.field private !T[0...,0...] a
.field private !S[][0...,0...] b
.method public hidebysig specialname
instance !T get_Item(int32 i,
int32 j) cil managed
{
// Code size 19 (0x13)
.maxstack 3
.locals init (!T V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0007: ldarg.1
IL_0008: ldarg.2
IL_0009: call instance !T !T[0...,0...]::Get(int32,
int32)
IL_000e: stloc.0
IL_000f: br.s IL_0011
IL_0011: ldloc.0
IL_0012: ret
} // end of method Generic`2::get_Item
.method public hidebysig specialname
instance void set_Item(int32 i,
int32 j,
!T 'value') cil managed
{
// Code size 16 (0x10)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0007: ldarg.1
IL_0008: ldarg.2
IL_0009: ldarg.3
IL_000a: call instance void !T[0...,0...]::Set(int32,
int32,
!T)
IL_000f: ret
} // end of method Generic`2::set_Item
.method public hidebysig instance void
TestB(!S x,
!S& y) cil managed
{
// Code size 95 (0x5f)
.maxstack 4
.locals init (!S V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0007: ldc.i4.5
IL_0008: ldc.i4.3
IL_0009: ldc.i4.s 10
IL_000b: newarr !S
IL_0010: call instance void !S[][0...,0...]::Set(int32,
int32,
!S[])
IL_0015: ldarg.0
IL_0016: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001b: ldc.i4.5
IL_001c: ldc.i4.3
IL_001d: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0022: ldc.i4.0
IL_0023: ldloca.s V_0
IL_0025: initobj !S
IL_002b: ldloc.0
IL_002c: stelem !S
IL_0031: ldarg.0
IL_0032: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_0037: ldc.i4.5
IL_0038: ldc.i4.3
IL_0039: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_003e: ldc.i4.1
IL_003f: ldarg.1
IL_0040: stelem !S
IL_0045: ldarg.0
IL_0046: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_004b: ldc.i4.5
IL_004c: ldc.i4.3
IL_004d: call instance !S[] !S[][0...,0...]::Get(int32,
int32)
IL_0052: ldc.i4.2
IL_0053: ldarg.2
IL_0054: ldobj !S
IL_0059: stelem !S
IL_005e: ret
} // end of method Generic`2::TestB
.method public hidebysig instance void
PassByReference(!T& arr) cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.0
IL_0003: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_0008: ldc.i4.s 10
IL_000a: ldc.i4.s 10
IL_000c: call instance !T& !T[0...,0...]::Address(int32,
int32)
IL_0011: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::PassByReference(!0&)
IL_0016: nop
IL_0017: ret
} // end of method Generic`2::PassByReference
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 38 (0x26)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.s 20
IL_0003: ldc.i4.s 20
IL_0005: newobj instance void !T[0...,0...]::.ctor(int32,
int32)
IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::a
IL_000f: ldarg.0
IL_0010: ldc.i4.s 20
IL_0012: ldc.i4.s 20
IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32,
int32)
IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2<!T,!S>::b
IL_001e: ldarg.0
IL_001f: call instance void [mscorlib]System.Object::.ctor()
IL_0024: nop
IL_0025: ret
} // end of method Generic`2::.ctor
.property instance !T Item(int32,
int32)
{
.get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32,
int32)
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32,
int32,
!T)
} // end of property Generic`2::Item
} // end of class Generic`2
.method public hidebysig instance int32[0...,0...][]
MakeArray() cil managed
{
// Code size 13 (0xd)
.maxstack 1
.locals init (int32[0...,0...][] V_0)
IL_0000: nop
IL_0001: ldc.i4.s 10
IL_0003: newarr int32[0...,0...]
IL_0008: stloc.0
IL_0009: br.s IL_000b
IL_000b: ldloc.0
IL_000c: ret
} // end of method MultidimensionalArray::MakeArray
.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 MultidimensionalArray::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

12
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.cs

@ -31,11 +31,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -31,11 +31,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
get;
set;
}
public MyClass this[int index] {
get {
return null;
}
}
public MyClass this[int index] => null;
public MyClass Method(int arg)
{
return null;
@ -52,11 +48,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -52,11 +48,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public MyClass Field;
public MyStruct? Property1 => null;
public MyStruct Property2 => default(MyStruct);
public MyStruct? this[int index] {
get {
return null;
}
}
public MyStruct? this[int index] => null;
public MyStruct? Method1(int arg)
{
return null;

32
ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullPropagation.roslyn.il

@ -84,16 +84,10 @@ @@ -84,16 +84,10 @@
instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass
get_Item(int32 index) cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass V_0)
IL_0000: nop
IL_0001: ldnull
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldnull
IL_0001: ret
} // end of method MyClass::get_Item
.method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyClass
@ -180,19 +174,13 @@ @@ -180,19 +174,13 @@
instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>
get_Item(int32 index) cil managed
{
// Code size 15 (0xf)
// Code size 10 (0xa)
.maxstack 1
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0,
valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_1)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: initobj valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>
IL_0009: ldloc.0
IL_000a: stloc.1
IL_000b: br.s IL_000d
IL_000d: ldloc.1
IL_000e: ret
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct> V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>
IL_0008: ldloc.0
IL_0009: ret
} // end of method MyStruct::get_Item
.method public hidebysig instance valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.NullPropagation/MyStruct>

55
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.cs

@ -1,4 +1,23 @@ @@ -1,4 +1,23 @@
using System;
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Text;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
@ -127,6 +146,20 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -127,6 +146,20 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
private set;
}
public int AutomaticProperty {
get;
set;
}
public int CustomProperty {
get {
return AutomaticProperty;
}
set {
AutomaticProperty = value;
}
}
private object Issue1221 {
set {
issue1221 = value;
@ -166,5 +199,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -166,5 +199,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
AutomaticEvent -= value;
}
}
public int Getter(StringBuilder b)
{
return b.Length;
}
public void Setter(StringBuilder b)
{
b.Capacity = 100;
}
public char IndexerGetter(StringBuilder b)
{
return b[50];
}
public void IndexerSetter(StringBuilder b)
{
b[42] = 'b';
}
}
}

154
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.il

@ -66,8 +66,8 @@ @@ -66,8 +66,8 @@
.event [mscorlib]System.Action Event
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event(class [mscorlib]System.Action)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
} // end of event IBase::Event
.property instance int32 GetterOnly()
{
@ -109,8 +109,8 @@ @@ -109,8 +109,8 @@
.event [mscorlib]System.EventHandler ThisIsAnAbstractEvent
{
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
} // end of event BaseClass::ThisIsAnAbstractEvent
} // end of class BaseClass
@ -299,8 +299,8 @@ @@ -299,8 +299,8 @@
} // end of event ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Event
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
} // end of property ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.GetterOnly()
{
@ -449,8 +449,8 @@ @@ -449,8 +449,8 @@
.event [mscorlib]System.Action Event
{
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::remove_Event(class [mscorlib]System.Action)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::add_Event(class [mscorlib]System.Action)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::remove_Event(class [mscorlib]System.Action)
} // end of event Impl::Event
.property instance int32 GetterOnly()
{
@ -462,8 +462,8 @@ @@ -462,8 +462,8 @@
} // end of property Impl::SetterOnly
.property instance int32 Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::set_Test(int32)
} // end of property Impl::Test
} // end of class Impl
@ -496,8 +496,8 @@ @@ -496,8 +496,8 @@
} // end of event IChange::Changed
.property instance int32 Property()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::get_Property()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
} // end of property IChange::Property
} // end of class IChange
@ -591,8 +591,8 @@ @@ -591,8 +591,8 @@
} // end of event Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.Changed
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.Property()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.get_Property()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.set_Property(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.get_Property()
} // end of property Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.Property
} // end of class Change
@ -602,6 +602,8 @@ @@ -602,6 +602,8 @@
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private int32 '<AutomaticProperty>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private static class [mscorlib]System.EventHandler 'CS$<>9__CachedAnonymousMethodDelegate1'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.method public hidebysig specialname instance int32
@ -632,6 +634,63 @@ @@ -632,6 +634,63 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_AutomaticProperty() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 11 (0xb)
.maxstack 1
.locals init (int32 V_0)
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0006: stloc.0
IL_0007: br.s IL_0009
IL_0009: ldloc.0
IL_000a: ret
} // end of method PropertiesAndEvents::get_AutomaticProperty
.method public hidebysig specialname instance void
set_AutomaticProperty(int32 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0007: ret
} // end of method PropertiesAndEvents::set_AutomaticProperty
.method public hidebysig specialname instance int32
get_CustomProperty() cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method PropertiesAndEvents::get_CustomProperty
.method public hidebysig specialname instance void
set_CustomProperty(int32 'value') cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
IL_0008: nop
IL_0009: ret
} // end of method PropertiesAndEvents::set_CustomProperty
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
@ -870,6 +929,67 @@ @@ -870,6 +929,67 @@
IL_0009: ret
} // end of method PropertiesAndEvents::remove_CustomEvent
.method public hidebysig instance int32
Getter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: callvirt instance int32 [mscorlib]System.Text.StringBuilder::get_Length()
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method PropertiesAndEvents::Getter
.method public hidebysig instance void
Setter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.s 100
IL_0004: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Capacity(int32)
IL_0009: nop
IL_000a: ret
} // end of method PropertiesAndEvents::Setter
.method public hidebysig instance char
IndexerGetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 14 (0xe)
.maxstack 2
.locals init (char V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.s 50
IL_0004: callvirt instance char [mscorlib]System.Text.StringBuilder::get_Chars(int32)
IL_0009: stloc.0
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ret
} // end of method PropertiesAndEvents::IndexerGetter
.method public hidebysig instance void
IndexerSetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.s 42
IL_0004: ldc.i4.s 98
IL_0006: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Chars(int32,
char)
IL_000b: nop
IL_000c: ret
} // end of method PropertiesAndEvents::IndexerSetter
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -907,32 +1027,42 @@ @@ -907,32 +1027,42 @@
.event [mscorlib]System.EventHandler AutomaticEvent
{
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEvent
.event [mscorlib]System.EventHandler AutomaticEventWithInitializer
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEventWithInitializer
.event [mscorlib]System.EventHandler CustomEvent
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_CustomEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::CustomEvent
.property instance int32 Value()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
} // end of property PropertiesAndEvents::Value
.property instance int32 AutomaticProperty()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
} // end of property PropertiesAndEvents::AutomaticProperty
.property instance int32 CustomProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_CustomProperty()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_CustomProperty(int32)
} // end of property PropertiesAndEvents::CustomProperty
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)
} // end of property PropertiesAndEvents::Issue1221
.property instance object Item()
{
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Item()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Item(object)
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Item()
} // end of property PropertiesAndEvents::Item
.property instance int32 NotAnAutoProperty()
{

125
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.il

@ -66,8 +66,8 @@ @@ -66,8 +66,8 @@
.event [mscorlib]System.Action Event
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event(class [mscorlib]System.Action)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event(class [mscorlib]System.Action)
} // end of event IBase::Event
.property instance int32 GetterOnly()
{
@ -109,8 +109,8 @@ @@ -109,8 +109,8 @@
.event [mscorlib]System.EventHandler ThisIsAnAbstractEvent
{
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::add_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/BaseClass::remove_ThisIsAnAbstractEvent(class [mscorlib]System.EventHandler)
} // end of event BaseClass::ThisIsAnAbstractEvent
} // end of class BaseClass
@ -281,8 +281,8 @@ @@ -281,8 +281,8 @@
} // end of event ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Event
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
} // end of property ExplicitImpl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.GetterOnly()
{
@ -415,8 +415,8 @@ @@ -415,8 +415,8 @@
.event [mscorlib]System.Action Event
{
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::remove_Event(class [mscorlib]System.Action)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::add_Event(class [mscorlib]System.Action)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::remove_Event(class [mscorlib]System.Action)
} // end of event Impl::Event
.property instance int32 GetterOnly()
{
@ -428,8 +428,8 @@ @@ -428,8 +428,8 @@
} // end of property Impl::SetterOnly
.property instance int32 Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::set_Test(int32)
} // end of property Impl::Test
} // end of class Impl
@ -462,8 +462,8 @@ @@ -462,8 +462,8 @@
} // end of event IChange::Changed
.property instance int32 Property()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::get_Property()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IChange::set_Property(int32)
} // end of property IChange::Property
} // end of class IChange
@ -550,8 +550,8 @@ @@ -550,8 +550,8 @@
} // end of event Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.Changed
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.Property()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.get_Property()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.set_Property(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.get_Property()
} // end of property Change::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IChange.Property
} // end of class Change
@ -561,6 +561,8 @@ @@ -561,6 +561,8 @@
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private int32 '<AutomaticProperty>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private static class [mscorlib]System.EventHandler 'CS$<>9__CachedAnonymousMethodDelegate1'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.method public hidebysig specialname instance int32
@ -586,6 +588,50 @@ @@ -586,6 +588,50 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_AutomaticProperty() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0006: ret
} // end of method PropertiesAndEvents::get_AutomaticProperty
.method public hidebysig specialname instance void
set_AutomaticProperty(int32 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0007: ret
} // end of method PropertiesAndEvents::set_AutomaticProperty
.method public hidebysig specialname instance int32
get_CustomProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
IL_0006: ret
} // end of method PropertiesAndEvents::get_CustomProperty
.method public hidebysig specialname instance void
set_CustomProperty(int32 'value') cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
IL_0007: ret
} // end of method PropertiesAndEvents::set_CustomProperty
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
@ -782,6 +828,51 @@ @@ -782,6 +828,51 @@
IL_0007: ret
} // end of method PropertiesAndEvents::remove_CustomEvent
.method public hidebysig instance int32
Getter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.1
IL_0001: callvirt instance int32 [mscorlib]System.Text.StringBuilder::get_Length()
IL_0006: ret
} // end of method PropertiesAndEvents::Getter
.method public hidebysig instance void
Setter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldc.i4.s 100
IL_0003: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Capacity(int32)
IL_0008: ret
} // end of method PropertiesAndEvents::Setter
.method public hidebysig instance char
IndexerGetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldc.i4.s 50
IL_0003: callvirt instance char [mscorlib]System.Text.StringBuilder::get_Chars(int32)
IL_0008: ret
} // end of method PropertiesAndEvents::IndexerGetter
.method public hidebysig instance void
IndexerSetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldc.i4.s 42
IL_0003: ldc.i4.s 98
IL_0005: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Chars(int32,
char)
IL_000a: ret
} // end of method PropertiesAndEvents::IndexerSetter
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -815,32 +906,42 @@ @@ -815,32 +906,42 @@
.event [mscorlib]System.EventHandler AutomaticEvent
{
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEvent
.event [mscorlib]System.EventHandler AutomaticEventWithInitializer
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_AutomaticEventWithInitializer(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::AutomaticEventWithInitializer
.event [mscorlib]System.EventHandler CustomEvent
{
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
.removeon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::remove_CustomEvent(class [mscorlib]System.EventHandler)
.addon instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::add_CustomEvent(class [mscorlib]System.EventHandler)
} // end of event PropertiesAndEvents::CustomEvent
.property instance int32 Value()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
} // end of property PropertiesAndEvents::Value
.property instance int32 AutomaticProperty()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
} // end of property PropertiesAndEvents::AutomaticProperty
.property instance int32 CustomProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_CustomProperty()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_CustomProperty(int32)
} // end of property PropertiesAndEvents::CustomProperty
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)
} // end of property PropertiesAndEvents::Issue1221
.property instance object Item()
{
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Item()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Item(object)
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Item()
} // end of property PropertiesAndEvents::Item
.property instance int32 NotAnAutoProperty()
{

113
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.roslyn.il

@ -576,7 +576,7 @@ @@ -576,7 +576,7 @@
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__29_0'
.field public static class [mscorlib]System.EventHandler '<>9__40_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -598,13 +598,13 @@ @@ -598,13 +598,13 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<.ctor>b__29_0'(object '<p0>',
'<.ctor>b__40_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method '<>c'::'<.ctor>b__29_0'
} // end of method '<>c'::'<.ctor>b__40_0'
} // end of class '<>c'
@ -612,6 +612,8 @@ @@ -612,6 +612,8 @@
.field private object issue1221
.field private int32 '<Value>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private int32 '<AutomaticProperty>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private class [mscorlib]System.EventHandler AutomaticEvent
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
@ -639,6 +641,50 @@ @@ -639,6 +641,50 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_AutomaticProperty() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0006: ret
} // end of method PropertiesAndEvents::get_AutomaticProperty
.method public hidebysig specialname instance void
set_AutomaticProperty(int32 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0007: ret
} // end of method PropertiesAndEvents::set_AutomaticProperty
.method public hidebysig specialname instance int32
get_CustomProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
IL_0006: ret
} // end of method PropertiesAndEvents::get_CustomProperty
.method public hidebysig specialname instance void
set_CustomProperty(int32 'value') cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
IL_0007: ret
} // end of method PropertiesAndEvents::set_CustomProperty
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
@ -839,24 +885,69 @@ @@ -839,24 +885,69 @@
IL_0007: ret
} // end of method PropertiesAndEvents::remove_CustomEvent
.method public hidebysig instance int32
Getter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.1
IL_0001: callvirt instance int32 [mscorlib]System.Text.StringBuilder::get_Length()
IL_0006: ret
} // end of method PropertiesAndEvents::Getter
.method public hidebysig instance void
Setter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldc.i4.s 100
IL_0003: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Capacity(int32)
IL_0008: ret
} // end of method PropertiesAndEvents::Setter
.method public hidebysig instance char
IndexerGetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldc.i4.s 50
IL_0003: callvirt instance char [mscorlib]System.Text.StringBuilder::get_Chars(int32)
IL_0008: ret
} // end of method PropertiesAndEvents::IndexerGetter
.method public hidebysig instance void
IndexerSetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldc.i4.s 42
IL_0003: ldc.i4.s 98
IL_0005: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Chars(int32,
char)
IL_000a: ret
} // end of method PropertiesAndEvents::IndexerSetter
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 44 (0x2c)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__29_0'
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__40_0'
IL_0006: dup
IL_0007: brtrue.s IL_0020
IL_0009: pop
IL_000a: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9'
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__29_0'(object,
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__40_0'(object,
class [mscorlib]System.EventArgs)
IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int)
IL_001a: dup
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__29_0'
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__40_0'
IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer
IL_0025: ldarg.0
IL_0026: call instance void [mscorlib]System.Object::.ctor()
@ -883,6 +974,16 @@ @@ -883,6 +974,16 @@
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
} // end of property PropertiesAndEvents::Value
.property instance int32 AutomaticProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
} // end of property PropertiesAndEvents::AutomaticProperty
.property instance int32 CustomProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_CustomProperty()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_CustomProperty(int32)
} // end of property PropertiesAndEvents::CustomProperty
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)

138
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.roslyn.il

@ -596,7 +596,7 @@ @@ -596,7 +596,7 @@
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__29_0'
.field public static class [mscorlib]System.EventHandler '<>9__40_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -619,14 +619,14 @@ @@ -619,14 +619,14 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<.ctor>b__29_0'(object '<p0>',
'<.ctor>b__40_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method '<>c'::'<.ctor>b__29_0'
} // end of method '<>c'::'<.ctor>b__40_0'
} // end of class '<>c'
@ -635,6 +635,9 @@ @@ -635,6 +635,9 @@
.field private int32 '<Value>k__BackingField'
.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 )
.field private int32 '<AutomaticProperty>k__BackingField'
.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 )
.field private class [mscorlib]System.EventHandler AutomaticEvent
.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 )
@ -664,6 +667,58 @@ @@ -664,6 +667,58 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_AutomaticProperty() cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0006: ret
} // end of method PropertiesAndEvents::get_AutomaticProperty
.method public hidebysig specialname instance void
set_AutomaticProperty(int32 'value') cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::'<AutomaticProperty>k__BackingField'
IL_0007: ret
} // end of method PropertiesAndEvents::set_AutomaticProperty
.method public hidebysig specialname instance int32
get_CustomProperty() cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method PropertiesAndEvents::get_CustomProperty
.method public hidebysig specialname instance void
set_CustomProperty(int32 'value') cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
IL_0008: nop
IL_0009: ret
} // end of method PropertiesAndEvents::set_CustomProperty
.method private hidebysig specialname instance void
set_Issue1221(object 'value') cil managed
{
@ -876,24 +931,85 @@ @@ -876,24 +931,85 @@
IL_0009: ret
} // end of method PropertiesAndEvents::remove_CustomEvent
.method public hidebysig instance int32
Getter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: callvirt instance int32 [mscorlib]System.Text.StringBuilder::get_Length()
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method PropertiesAndEvents::Getter
.method public hidebysig instance void
Setter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 11 (0xb)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.s 100
IL_0004: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Capacity(int32)
IL_0009: nop
IL_000a: ret
} // end of method PropertiesAndEvents::Setter
.method public hidebysig instance char
IndexerGetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 14 (0xe)
.maxstack 2
.locals init (char V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.s 50
IL_0004: callvirt instance char [mscorlib]System.Text.StringBuilder::get_Chars(int32)
IL_0009: stloc.0
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ret
} // end of method PropertiesAndEvents::IndexerGetter
.method public hidebysig instance void
IndexerSetter(class [mscorlib]System.Text.StringBuilder b) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.s 42
IL_0004: ldc.i4.s 98
IL_0006: callvirt instance void [mscorlib]System.Text.StringBuilder::set_Chars(int32,
char)
IL_000b: nop
IL_000c: ret
} // end of method PropertiesAndEvents::IndexerSetter
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 45 (0x2d)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__29_0'
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__40_0'
IL_0006: dup
IL_0007: brtrue.s IL_0020
IL_0009: pop
IL_000a: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9'
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__29_0'(object,
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__40_0'(object,
class [mscorlib]System.EventArgs)
IL_0015: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int)
IL_001a: dup
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__29_0'
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__40_0'
IL_0020: stfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::AutomaticEventWithInitializer
IL_0025: ldarg.0
IL_0026: call instance void [mscorlib]System.Object::.ctor()
@ -921,6 +1037,16 @@ @@ -921,6 +1037,16 @@
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_Value()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Value(int32)
} // end of property PropertiesAndEvents::Value
.property instance int32 AutomaticProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_AutomaticProperty()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_AutomaticProperty(int32)
} // end of property PropertiesAndEvents::AutomaticProperty
.property instance int32 CustomProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_CustomProperty()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_CustomProperty(int32)
} // end of property PropertiesAndEvents::CustomProperty
.property instance object Issue1221()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::set_Issue1221(object)

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

@ -23,6 +23,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -23,6 +23,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class TypeAnalysisTests
{
private class @_
{
}
private byte[] byteArray;
public byte SubtractFrom256(byte b)
@ -123,6 +127,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -123,6 +127,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
Console.WriteLine(o is Random);
Console.WriteLine(!(o is Random));
// If we didn't escape the '_' identifier here, this would look like a discard pattern
Console.WriteLine(o is @_);
}
public byte[] CreateArrayWithInt(int length)

25
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.il

@ -32,6 +32,21 @@ @@ -32,6 +32,21 @@
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests
extends [mscorlib]System.Object
{
.class auto ansi nested private beforefieldinit _
extends [mscorlib]System.Object
{
.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 _::.ctor
} // end of class _
.field private uint8[] byteArray
.method public hidebysig instance uint8
SubtractFrom256(uint8 b) cil managed
@ -392,7 +407,7 @@ @@ -392,7 +407,7 @@
.method public hidebysig instance void
OperatorIs(object o) cil managed
{
// Code size 35 (0x23)
// Code size 50 (0x32)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
@ -409,7 +424,13 @@ @@ -409,7 +424,13 @@
IL_001a: ceq
IL_001c: call void [mscorlib]System.Console::WriteLine(bool)
IL_0021: nop
IL_0022: ret
IL_0022: ldarg.1
IL_0023: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests/_
IL_0028: ldnull
IL_0029: cgt.un
IL_002b: call void [mscorlib]System.Console::WriteLine(bool)
IL_0030: nop
IL_0031: ret
} // end of method TypeAnalysisTests::OperatorIs
.method public hidebysig instance uint8[]

24
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.opt.il

@ -32,6 +32,21 @@ @@ -32,6 +32,21 @@
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests
extends [mscorlib]System.Object
{
.class auto ansi nested private beforefieldinit _
extends [mscorlib]System.Object
{
.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 _::.ctor
} // end of class _
.field private uint8[] byteArray
.method public hidebysig instance uint8
SubtractFrom256(uint8 b) cil managed
@ -278,7 +293,7 @@ @@ -278,7 +293,7 @@
.method public hidebysig instance void
OperatorIs(object o) cil managed
{
// Code size 32 (0x20)
// Code size 46 (0x2e)
.maxstack 8
IL_0000: ldarg.1
IL_0001: isinst [mscorlib]System.Random
@ -292,7 +307,12 @@ @@ -292,7 +307,12 @@
IL_0017: ldc.i4.0
IL_0018: ceq
IL_001a: call void [mscorlib]System.Console::WriteLine(bool)
IL_001f: ret
IL_001f: ldarg.1
IL_0020: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests/_
IL_0025: ldnull
IL_0026: cgt.un
IL_0028: call void [mscorlib]System.Console::WriteLine(bool)
IL_002d: ret
} // end of method TypeAnalysisTests::OperatorIs
.method public hidebysig instance uint8[]

24
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.opt.roslyn.il

@ -36,6 +36,21 @@ @@ -36,6 +36,21 @@
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests
extends [mscorlib]System.Object
{
.class auto ansi nested private beforefieldinit _
extends [mscorlib]System.Object
{
.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 _::.ctor
} // end of class _
.field private uint8[] byteArray
.method public hidebysig instance uint8
SubtractFrom256(uint8 b) cil managed
@ -282,7 +297,7 @@ @@ -282,7 +297,7 @@
.method public hidebysig instance void
OperatorIs(object o) cil managed
{
// Code size 32 (0x20)
// Code size 46 (0x2e)
.maxstack 8
IL_0000: ldarg.1
IL_0001: isinst [mscorlib]System.Random
@ -296,7 +311,12 @@ @@ -296,7 +311,12 @@
IL_0017: ldc.i4.0
IL_0018: ceq
IL_001a: call void [mscorlib]System.Console::WriteLine(bool)
IL_001f: ret
IL_001f: ldarg.1
IL_0020: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests/_
IL_0025: ldnull
IL_0026: cgt.un
IL_0028: call void [mscorlib]System.Console::WriteLine(bool)
IL_002d: ret
} // end of method TypeAnalysisTests::OperatorIs
.method public hidebysig instance uint8[]

26
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.roslyn.il

@ -36,6 +36,22 @@ @@ -36,6 +36,22 @@
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests
extends [mscorlib]System.Object
{
.class auto ansi nested private beforefieldinit _
extends [mscorlib]System.Object
{
.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 _::.ctor
} // end of class _
.field private uint8[] byteArray
.method public hidebysig instance uint8
SubtractFrom256(uint8 b) cil managed
@ -393,7 +409,7 @@ @@ -393,7 +409,7 @@
.method public hidebysig instance void
OperatorIs(object o) cil managed
{
// Code size 35 (0x23)
// Code size 50 (0x32)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
@ -410,7 +426,13 @@ @@ -410,7 +426,13 @@
IL_001a: ceq
IL_001c: call void [mscorlib]System.Console::WriteLine(bool)
IL_0021: nop
IL_0022: ret
IL_0022: ldarg.1
IL_0023: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.TypeAnalysisTests/_
IL_0028: ldnull
IL_0029: cgt.un
IL_002b: call void [mscorlib]System.Console::WriteLine(bool)
IL_0030: nop
IL_0031: ret
} // end of method TypeAnalysisTests::OperatorIs
.method public hidebysig instance uint8[]

945
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.cs

@ -0,0 +1,945 @@ @@ -0,0 +1,945 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class IndexerWithGetOnly
{
#if ROSLYN
public int this[int i] => i;
#else
public int this[int i] {
get {
return i;
}
}
#endif
}
public class IndexerWithSetOnly
{
public int this[int i] {
set {
}
}
}
public class IndexerWithMoreParameters
{
#if ROSLYN
public int this[int i, string s, Type t] => 0;
#else
public int this[int i, string s, Type t] {
get {
return 0;
}
}
#endif
}
public class IndexerInGenericClass<T>
{
#if ROSLYN
public int this[T t] => 0;
#else
public int this[T t] {
get {
return 0;
}
}
#endif
}
public class OverloadedIndexer
{
#if ROSLYN
public int this[int t] => 0;
#else
public int this[int t] {
get {
return 0;
}
}
#endif
public int this[string s] {
get {
return 0;
}
set {
Console.WriteLine(value + " " + s);
}
}
}
public interface IIndexerInInterface
{
int this[string s, string s2] {
set;
}
}
public interface IMyInterface_IndexerInterfaceExplicitImplementation
{
int this[string s] {
get;
}
}
public class MyClass_IndexerInterfaceExplicitImplementation : IMyInterface_IndexerInterfaceExplicitImplementation
{
#if ROSLYN
int IMyInterface_IndexerInterfaceExplicitImplementation.this[string s] => 3;
#else
int IMyInterface_IndexerInterfaceExplicitImplementation.this[string s] {
get {
return 3;
}
}
#endif
}
public interface IMyInterface_IndexerInterfaceImplementation
{
int this[string s] {
get;
}
}
public class MyClass_IndexerInterfaceImplementation : IMyInterface_IndexerInterfaceImplementation
{
#if ROSLYN
public int this[string s] => 3;
#else
public int this[string s] {
get {
return 3;
}
}
#endif
}
public abstract class MyClass_IndexerAbstract
{
public abstract int this[string s, string s2] {
set;
}
protected abstract string this[int index] {
get;
}
}
public interface IMyInterface_MethodExplicit
{
void MyMethod();
}
public class MyClass_MethodExplicit : IMyInterface_MethodExplicit
{
void IMyInterface_MethodExplicit.MyMethod()
{
}
}
public interface IMyInterface_MethodFromInterfaceVirtual
{
void MyMethod();
}
public class MyClass : IMyInterface_MethodFromInterfaceVirtual
{
public virtual void MyMethod()
{
}
}
public interface IMyInterface_MethodFromInterface
{
void MyMethod();
}
public class MyClass_MethodFromInterface : IMyInterface_MethodFromInterface
{
public void MyMethod()
{
}
}
public interface IMyInterface_MethodFromInterfaceAbstract
{
void MyMethod();
}
public abstract class MyClass_MethodFromInterfaceAbstract : IMyInterface_MethodFromInterfaceAbstract
{
public abstract void MyMethod();
}
public interface IMyInterface_PropertyInterface
{
int MyProperty {
get;
set;
}
}
public interface IMyInterface_PropertyInterfaceExplicitImplementation
{
int MyProperty {
get;
set;
}
}
public class MyClass_PropertyInterfaceExplicitImplementation : IMyInterface_PropertyInterfaceExplicitImplementation
{
int IMyInterface_PropertyInterfaceExplicitImplementation.MyProperty {
get {
return 0;
}
set {
}
}
}
public interface IMyInterface_PropertyInterfaceImplementation
{
int MyProperty {
get;
set;
}
}
public class MyClass_PropertyInterfaceImplementation : IMyInterface_PropertyInterfaceImplementation
{
public int MyProperty {
get {
return 0;
}
set {
}
}
}
public class MyClass_PropertyPrivateGetPublicSet
{
public int MyProperty {
private get {
return 3;
}
set {
}
}
}
public class MyClass_PropertyPublicGetProtectedSet
{
public int MyProperty {
get {
return 3;
}
protected set {
}
}
}
public class MyClass_PropertyOverrideDefaultAccessorOnly
{
public virtual int MyProperty {
get {
return 3;
}
protected set {
}
}
}
public class Derived_PropertyOverrideDefaultAccessorOnly : MyClass_PropertyOverrideDefaultAccessorOnly
{
#if ROSLYN
public override int MyProperty => 4;
#else
public override int MyProperty {
get {
return 4;
}
}
#endif
}
public class MyClass_PropertyOverrideRestrictedAccessorOnly
{
public virtual int MyProperty {
get {
return 3;
}
protected set {
}
}
}
public class Derived_PropertyOverrideRestrictedAccessorOnly : MyClass_PropertyOverrideRestrictedAccessorOnly
{
public override int MyProperty {
protected set {
}
}
}
public class MyClass_PropertyOverrideOneAccessor
{
protected internal virtual int MyProperty {
get {
return 3;
}
protected set {
}
}
}
public class DerivedNew_PropertyOverrideOneAccessor : MyClass_PropertyOverrideOneAccessor
{
public new virtual int MyProperty {
set {
}
}
}
public class DerivedOverride_PropertyOverrideOneAccessor : DerivedNew_PropertyOverrideOneAccessor
{
public override int MyProperty {
set {
}
}
}
public class MyClass_IndexerOverrideRestrictedAccessorOnly
{
public virtual int this[string s] {
get {
return 3;
}
protected set {
}
}
protected internal virtual int this[int i] {
protected get {
return 2;
}
set {
}
}
}
public class Derived_IndexerOverrideRestrictedAccessorOnly : MyClass_IndexerOverrideRestrictedAccessorOnly
{
protected internal override int this[int i] {
protected get {
return 4;
}
}
}
public class A_HideProperty
{
public virtual int P {
get {
return 0;
}
set {
}
}
}
public class B_HideProperty : A_HideProperty
{
private new int P {
get {
return 0;
}
set {
}
}
}
public class C_HideProperty : B_HideProperty
{
public override int P {
set {
}
}
}
public class A_HideMembers
{
public int F;
#if ROSLYN
public int Prop => 3;
public int G => 3;
#else
public int Prop {
get {
return 3;
}
}
public int G {
get {
return 3;
}
}
#endif
}
public class B_HideMembers : A_HideMembers
{
#if ROSLYN
public new int F => 3;
public new string Prop => "a";
#else
public new int F {
get {
return 3;
}
}
public new string Prop {
get {
return "a";
}
}
#endif
}
public class C_HideMembers : A_HideMembers
{
public new int G;
}
public class D_HideMembers : A_HideMembers
{
public new void F()
{
}
}
public class D1_HideMembers : D_HideMembers
{
public new int F;
}
public class E_HideMembers : A_HideMembers
{
private new class F
{
}
}
public class G_HideMembers2
{
#if ROSLYN
public int Item => 1;
#else
public int Item {
get {
return 1;
}
}
#endif
}
public class G2_HideMembers2 : G_HideMembers2
{
#if ROSLYN
public int this[int i] => 2;
#else
public int this[int i] {
get {
return 2;
}
}
#endif
}
public class G3_HideMembers2 : G2_HideMembers2
{
#if ROSLYN
public new int Item => 4;
#else
public new int Item {
get {
return 4;
}
}
#endif
}
public class H_HideMembers2
{
#if ROSLYN
public int this[int j] => 0;
#else
public int this[int j] {
get {
return 0;
}
}
#endif
}
public class H2_HideMembers2 : H_HideMembers2
{
#if ROSLYN
public int Item => 2;
#else
public int Item {
get {
return 2;
}
}
#endif
}
public class H3_HideMembers2 : H2_HideMembers2
{
#if ROSLYN
public new string this[int j] => null;
#else
public new string this[int j] {
get {
return null;
}
}
#endif
}
public interface IA_HideMembers2a
{
int this[int i] {
get;
}
}
public class A_HideMembers2a : IA_HideMembers2a
{
int IA_HideMembers2a.this[int i] {
get {
throw new NotImplementedException();
}
}
}
public class A1_HideMembers2a : A_HideMembers2a
{
#if ROSLYN
public int this[int i] => 3;
#else
public int this[int i] {
get {
return 3;
}
}
#endif
}
public class G_HideMembers3<T>
{
public void M1(T p)
{
}
public int M2(int t)
{
return 3;
}
}
public class G1_HideMembers3<T> : G_HideMembers3<int>
{
public new int M1(int i)
{
return 0;
}
public int M2(T i)
{
return 2;
}
}
public class G2_HideMembers3<T> : G_HideMembers3<int>
{
public int M1(T p)
{
return 4;
}
}
public class J_HideMembers3
{
#if ROSLYN
public int P => 2;
#else
public int P {
get {
return 2;
}
}
#endif
}
public class J2_HideMembers3 : J_HideMembers3
{
#pragma warning disable 0108
// Deliberate bad code for test case
public int get_P;
#pragma warning restore 0108
}
public class A_HideMembers4
{
public void M<T>(T t)
{
}
}
public class A1_HideMembers4 : A_HideMembers4
{
public new void M<K>(K t)
{
}
public void M(int t)
{
}
}
public class B_HideMembers4
{
public void M<T>()
{
}
public void M1<T>()
{
}
public void M2<T>(T t)
{
}
}
public class B1_HideMembers4 : B_HideMembers4
{
public void M<T1, T2>()
{
}
public new void M1<R>()
{
}
public new void M2<R>(R r)
{
}
}
public class C_HideMembers4<T>
{
public void M<TT>(T t)
{
}
}
public class C1_HideMembers4<K> : C_HideMembers4<K>
{
public void M<TT>(TT t)
{
}
}
public class A_HideMembers5
{
public void M(int t)
{
}
}
public class A1_HideMembers5 : A_HideMembers5
{
public void M(ref int t)
{
}
}
public class B_HideMembers5
{
public void M(ref int l)
{
}
}
public class B1_HideMembers5 : B_HideMembers5
{
public void M(out int l)
{
l = 2;
}
public void M(ref long l)
{
}
}
public class A_HideMemberSkipNotVisible
{
protected int F;
#if ROSLYN
protected string P => null;
#else
protected string P {
get {
return null;
}
}
#endif
}
public class B_HideMemberSkipNotVisible : A_HideMemberSkipNotVisible
{
private new string F;
private new int P {
set {
}
}
}
public class A_HideNestedClass
{
public class N1
{
}
protected class N2
{
}
private class N3
{
}
internal class N4
{
}
protected internal class N5
{
}
}
public class B_HideNestedClass : A_HideNestedClass
{
public new int N1;
public new int N2;
public int N3;
public new int N4;
public new int N5;
}
public class A_HidePropertyReservedMethod
{
#if ROSLYN
public int P => 1;
#else
public int P {
get {
return 1;
}
}
#endif
}
public class B_HidePropertyReservedMethod : A_HidePropertyReservedMethod
{
public int get_P()
{
return 2;
}
public void set_P(int value)
{
}
}
public class A_HideIndexerDiffAccessor
{
#if ROSLYN
public int this[int i] => 2;
#else
public int this[int i] {
get {
return 2;
}
}
#endif
}
public class B_HideIndexerDiffAccessor : A_HideIndexerDiffAccessor
{
public new int this[int j] {
set {
}
}
}
public class A_HideIndexerGeneric<T>
{
public virtual int this[T r] {
get {
return 0;
}
set {
}
}
}
public class B_HideIndexerGeneric : A_HideIndexerGeneric<int>
{
private new int this[int k] {
get {
return 0;
}
set {
}
}
}
public class C_HideIndexerGeneric<T> : A_HideIndexerGeneric<T>
{
public override int this[T s] {
set {
}
}
}
public class D_HideIndexerGeneric<T> : C_HideIndexerGeneric<T>
{
public new virtual int this[T s] {
set {
}
}
}
public class A_HideMethod
{
public virtual void F()
{
}
}
public class B_HideMethod : A_HideMethod
{
private new void F()
{
base.F();
}
}
public class C_HideMethod : B_HideMethod
{
public override void F()
{
base.F();
}
}
public class A_HideMethodGeneric<T>
{
public virtual void F(T s)
{
}
public new static bool Equals(object o1, object o2)
{
return true;
}
}
public class B_HideMethodGeneric : A_HideMethodGeneric<string>
{
private new void F(string k)
{
}
public void F(int i)
{
}
}
public class C_HideMethodGeneric<T> : A_HideMethodGeneric<T>
{
public override void F(T r)
{
}
public void G(T t)
{
}
}
public class D_HideMethodGeneric<T1> : C_HideMethodGeneric<T1>
{
public new virtual void F(T1 k)
{
}
public virtual void F<T2>(T2 k)
{
}
public virtual void G<T2>(T2 t)
{
}
}
public class A_HideMethodGenericSkipPrivate<T>
{
public virtual void F(T t)
{
}
}
public class B_HideMethodGenericSkipPrivate<T> : A_HideMethodGenericSkipPrivate<T>
{
private new void F(T t)
{
}
private void K()
{
}
}
public class C_HideMethodGenericSkipPrivate<T> : B_HideMethodGenericSkipPrivate<T>
{
public override void F(T tt)
{
}
public void K()
{
}
}
public class D_HideMethodGenericSkipPrivate : B_HideMethodGenericSkipPrivate<int>
{
public override void F(int t)
{
}
}
public class A_HideMethodGeneric2
{
public virtual void F(int i)
{
}
public void K()
{
}
}
public class B_HideMethodGeneric2<T> : A_HideMethodGeneric2
{
protected virtual void F(T t)
{
}
public void K<T2>()
{
}
}
public class C_HideMethodGeneric2 : B_HideMethodGeneric2<int>
{
protected override void F(int k)
{
}
public new void K<T3>()
{
}
}
public class D_HideMethodGeneric2 : B_HideMethodGeneric2<string>
{
public override void F(int k)
{
}
public void L<T4>()
{
}
}
public class E_HideMethodGeneric2<T>
{
public void M<T2>(T t, T2 t2)
{
}
}
public class F_HideMethodGeneric2<T> : E_HideMethodGeneric2<T>
{
public void M(T t1, T t2)
{
}
}
public class C1_HideMethodDiffSignatures<T>
{
public virtual void M(T arg)
{
}
}
public class C2_HideMethodDiffSignatures<T1, T2> : C1_HideMethodDiffSignatures<T2>
{
public new virtual void M(T2 arg)
{
}
}
public class C3_HideMethodDiffSignatures : C2_HideMethodDiffSignatures<int, bool>
{
public new virtual void M(bool arg)
{
}
}
public class A_HideMethodStatic
{
#if ROSLYN
public int N => 0;
#else
public int N {
get {
return 0;
}
}
#endif
}
public class B_HideMethodStatic
{
public int N()
{
return 0;
}
}
public class A_HideEvent
{
public virtual event EventHandler E;
public event EventHandler F;
}
public class B_HideEvent : A_HideEvent
{
public new virtual event EventHandler E;
public new event EventHandler F;
}
public class C_HideEvent : B_HideEvent
{
public override event EventHandler E;
}
}

3801
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.il

File diff suppressed because it is too large Load Diff

3392
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.opt.il

File diff suppressed because it is too large Load Diff

3411
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.opt.roslyn.il

File diff suppressed because it is too large Load Diff

3727
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeMemberTests.roslyn.il

File diff suppressed because it is too large Load Diff

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

@ -28,7 +28,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -28,7 +28,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public int X;
public double Y;
}
public struct ResultStruct
{
public unsafe byte* ptr1;
public unsafe byte* ptr2;
public unsafe ResultStruct(byte* ptr1, byte* ptr2)
{
this.ptr1 = ptr1;
this.ptr2 = ptr2;
}
}
public struct StructWithFixedSizeMembers
{
public unsafe fixed int Integers[100];
@ -387,5 +399,45 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -387,5 +399,45 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
bytePtr -= 4;
shortPtr = (short*)((byte*)shortPtr - 3);
}
private static T Get<T>()
{
return default(T);
}
private unsafe static ResultStruct NestedFixedBlocks(byte[] array)
{
try {
fixed (byte* ptr = array) {
fixed (byte* ptr2 = Get<byte[]>()) {
return new ResultStruct(ptr, ptr2);
}
}
} finally {
Console.WriteLine("Finally");
}
}
private unsafe static object CreateBuffer(int length, byte* ptr)
{
throw new NotImplementedException();
}
private unsafe static object Issue1386(int arraySize, bool createFirstBuffer)
{
if (createFirstBuffer) {
byte[] array = new byte[arraySize];
Console.WriteLine("first fixed");
fixed (byte* ptr = array) {
return CreateBuffer(array.Length, ptr);
}
}
byte[] array2 = new byte[arraySize];
Console.WriteLine("second fixed");
fixed (byte* ptr2 = array2) {
return CreateBuffer(array2.Length, ptr2);
}
}
}
}

247
ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.il

@ -39,6 +39,29 @@ @@ -39,6 +39,29 @@
.field public float64 Y
} // end of class SimpleStruct
.class sequential ansi sealed nested public beforefieldinit ResultStruct
extends [mscorlib]System.ValueType
{
.field public uint8* ptr1
.field public uint8* ptr2
.method public hidebysig specialname rtspecialname
instance void .ctor(uint8* ptr1,
uint8* ptr2) cil managed
{
// Code size 16 (0x10)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr1
IL_0008: ldarg.0
IL_0009: ldarg.2
IL_000a: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr2
IL_000f: ret
} // end of method ResultStruct::.ctor
} // end of class ResultStruct
.class sequential ansi sealed nested public beforefieldinit StructWithFixedSizeMembers
extends [mscorlib]System.ValueType
{
@ -1456,6 +1479,230 @@ @@ -1456,6 +1479,230 @@
IL_001d: ret
} // end of method UnsafeCode::Issue1021
.method private hidebysig static !!T Get<T>() cil managed
{
// Code size 15 (0xf)
.maxstack 1
.locals init (!!T V_0,
!!T V_1)
IL_0000: nop
IL_0001: ldloca.s V_1
IL_0003: initobj !!T
IL_0009: ldloc.1
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method UnsafeCode::Get
.method private hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct
NestedFixedBlocks(uint8[] 'array') cil managed
{
// Code size 91 (0x5b)
.maxstack 2
.locals init (uint8& pinned V_0,
uint8& pinned V_1,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct V_2,
uint8[] V_3)
IL_0000: nop
.try
{
IL_0001: nop
.try
{
IL_0002: ldarg.0
IL_0003: dup
IL_0004: stloc.3
IL_0005: brfalse.s IL_000c
IL_0007: ldloc.3
IL_0008: ldlen
IL_0009: conv.i4
IL_000a: brtrue.s IL_0011
IL_000c: ldc.i4.0
IL_000d: conv.u
IL_000e: stloc.0
IL_000f: br.s IL_0019
IL_0011: ldloc.3
IL_0012: ldc.i4.0
IL_0013: ldelema [mscorlib]System.Byte
IL_0018: stloc.0
IL_0019: nop
.try
{
IL_001a: call !!0 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::Get<uint8[]>()
IL_001f: dup
IL_0020: stloc.3
IL_0021: brfalse.s IL_0028
IL_0023: ldloc.3
IL_0024: ldlen
IL_0025: conv.i4
IL_0026: brtrue.s IL_002d
IL_0028: ldc.i4.0
IL_0029: conv.u
IL_002a: stloc.1
IL_002b: br.s IL_0035
IL_002d: ldloc.3
IL_002e: ldc.i4.0
IL_002f: ldelema [mscorlib]System.Byte
IL_0034: stloc.1
IL_0035: nop
IL_0036: ldloc.0
IL_0037: conv.i
IL_0038: ldloc.1
IL_0039: conv.i
IL_003a: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::.ctor(uint8*,
uint8*)
IL_003f: stloc.2
IL_0040: leave.s IL_0058
} // end .try
finally
{
IL_0042: ldc.i4.0
IL_0043: conv.u
IL_0044: stloc.1
IL_0045: endfinally
} // end handler
} // end .try
finally
{
IL_0046: ldc.i4.0
IL_0047: conv.u
IL_0048: stloc.0
IL_0049: endfinally
} // end handler
} // end .try
finally
{
IL_004a: nop
IL_004b: ldstr "Finally"
IL_0050: call void [mscorlib]System.Console::WriteLine(string)
IL_0055: nop
IL_0056: nop
IL_0057: endfinally
} // end handler
IL_0058: nop
IL_0059: ldloc.2
IL_005a: ret
} // end of method UnsafeCode::NestedFixedBlocks
.method private hidebysig static object
CreateBuffer(int32 length,
uint8* ptr) 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 UnsafeCode::CreateBuffer
.method private hidebysig static object
Issue1386(int32 arraySize,
bool createFirstBuffer) cil managed
{
// Code size 134 (0x86)
.maxstack 2
.locals init (uint8[] V_0,
uint8& pinned V_1,
uint8[] V_2,
uint8& pinned V_3,
object V_4,
bool V_5,
uint8[] V_6)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.0
IL_0003: ceq
IL_0005: stloc.s V_5
IL_0007: ldloc.s V_5
IL_0009: brtrue.s IL_0047
IL_000b: nop
IL_000c: ldarg.0
IL_000d: newarr [mscorlib]System.Byte
IL_0012: stloc.0
IL_0013: ldstr "first fixed"
IL_0018: call void [mscorlib]System.Console::WriteLine(string)
IL_001d: nop
IL_001e: ldloc.0
IL_001f: dup
IL_0020: stloc.s V_6
IL_0022: brfalse.s IL_002a
IL_0024: ldloc.s V_6
IL_0026: ldlen
IL_0027: conv.i4
IL_0028: brtrue.s IL_002f
IL_002a: ldc.i4.0
IL_002b: conv.u
IL_002c: stloc.1
IL_002d: br.s IL_0038
IL_002f: ldloc.s V_6
IL_0031: ldc.i4.0
IL_0032: ldelema [mscorlib]System.Byte
IL_0037: stloc.1
IL_0038: nop
IL_0039: ldloc.0
IL_003a: ldlen
IL_003b: conv.i4
IL_003c: ldloc.1
IL_003d: conv.i
IL_003e: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_0043: stloc.s V_4
IL_0045: leave.s IL_0082
IL_0047: ldarg.0
IL_0048: newarr [mscorlib]System.Byte
IL_004d: stloc.2
IL_004e: ldstr "second fixed"
IL_0053: call void [mscorlib]System.Console::WriteLine(string)
IL_0058: nop
IL_0059: ldloc.2
IL_005a: dup
IL_005b: stloc.s V_6
IL_005d: brfalse.s IL_0065
IL_005f: ldloc.s V_6
IL_0061: ldlen
IL_0062: conv.i4
IL_0063: brtrue.s IL_006a
IL_0065: ldc.i4.0
IL_0066: conv.u
IL_0067: stloc.3
IL_0068: br.s IL_0073
IL_006a: ldloc.s V_6
IL_006c: ldc.i4.0
IL_006d: ldelema [mscorlib]System.Byte
IL_0072: stloc.3
IL_0073: nop
IL_0074: ldloc.2
IL_0075: ldlen
IL_0076: conv.i4
IL_0077: ldloc.3
IL_0078: conv.i
IL_0079: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_007e: stloc.s V_4
IL_0080: leave.s IL_0082
IL_0082: nop
IL_0083: ldloc.s V_4
IL_0085: ret
} // end of method UnsafeCode::Issue1386
.property instance int32* NullPointer()
{
.get instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::get_NullPointer()

221
ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.opt.il

@ -39,6 +39,28 @@ @@ -39,6 +39,28 @@
.field public float64 Y
} // end of class SimpleStruct
.class sequential ansi sealed nested public beforefieldinit ResultStruct
extends [mscorlib]System.ValueType
{
.field public uint8* ptr1
.field public uint8* ptr2
.method public hidebysig specialname rtspecialname
instance void .ctor(uint8* ptr1,
uint8* ptr2) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr1
IL_0007: ldarg.0
IL_0008: ldarg.2
IL_0009: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr2
IL_000e: ret
} // end of method ResultStruct::.ctor
} // end of class ResultStruct
.class sequential ansi sealed nested public beforefieldinit StructWithFixedSizeMembers
extends [mscorlib]System.ValueType
{
@ -1166,6 +1188,205 @@ @@ -1166,6 +1188,205 @@
IL_001c: ret
} // end of method UnsafeCode::Issue1021
.method private hidebysig static !!T Get<T>() cil managed
{
// Code size 10 (0xa)
.maxstack 1
.locals init (!!T V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj !!T
IL_0008: ldloc.0
IL_0009: ret
} // end of method UnsafeCode::Get
.method private hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct
NestedFixedBlocks(uint8[] 'array') cil managed
{
// Code size 86 (0x56)
.maxstack 2
.locals init (uint8& pinned V_0,
uint8& pinned V_1,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct V_2,
uint8[] V_3,
uint8[] V_4)
.try
{
.try
{
IL_0000: ldarg.0
IL_0001: dup
IL_0002: stloc.3
IL_0003: brfalse.s IL_000a
IL_0005: ldloc.3
IL_0006: ldlen
IL_0007: conv.i4
IL_0008: brtrue.s IL_000f
IL_000a: ldc.i4.0
IL_000b: conv.u
IL_000c: stloc.0
IL_000d: br.s IL_0017
IL_000f: ldloc.3
IL_0010: ldc.i4.0
IL_0011: ldelema [mscorlib]System.Byte
IL_0016: stloc.0
.try
{
IL_0017: call !!0 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::Get<uint8[]>()
IL_001c: dup
IL_001d: stloc.s V_4
IL_001f: brfalse.s IL_0027
IL_0021: ldloc.s V_4
IL_0023: ldlen
IL_0024: conv.i4
IL_0025: brtrue.s IL_002c
IL_0027: ldc.i4.0
IL_0028: conv.u
IL_0029: stloc.1
IL_002a: br.s IL_0035
IL_002c: ldloc.s V_4
IL_002e: ldc.i4.0
IL_002f: ldelema [mscorlib]System.Byte
IL_0034: stloc.1
IL_0035: ldloc.0
IL_0036: conv.i
IL_0037: ldloc.1
IL_0038: conv.i
IL_0039: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::.ctor(uint8*,
uint8*)
IL_003e: stloc.2
IL_003f: leave.s IL_0054
} // end .try
finally
{
IL_0041: ldc.i4.0
IL_0042: conv.u
IL_0043: stloc.1
IL_0044: endfinally
} // end handler
} // end .try
finally
{
IL_0045: ldc.i4.0
IL_0046: conv.u
IL_0047: stloc.0
IL_0048: endfinally
} // end handler
} // end .try
finally
{
IL_0049: ldstr "Finally"
IL_004e: call void [mscorlib]System.Console::WriteLine(string)
IL_0053: endfinally
} // end handler
IL_0054: ldloc.2
IL_0055: ret
} // end of method UnsafeCode::NestedFixedBlocks
.method private hidebysig static object
CreateBuffer(int32 length,
uint8* ptr) cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0005: throw
} // end of method UnsafeCode::CreateBuffer
.method private hidebysig static object
Issue1386(int32 arraySize,
bool createFirstBuffer) cil managed
{
// Code size 120 (0x78)
.maxstack 2
.locals init (uint8[] V_0,
uint8& pinned V_1,
uint8[] V_2,
uint8& pinned V_3,
object V_4,
uint8[] V_5,
uint8[] V_6)
IL_0000: ldarg.1
IL_0001: brfalse.s IL_003c
IL_0003: ldarg.0
IL_0004: newarr [mscorlib]System.Byte
IL_0009: stloc.0
IL_000a: ldstr "first fixed"
IL_000f: call void [mscorlib]System.Console::WriteLine(string)
IL_0014: ldloc.0
IL_0015: dup
IL_0016: stloc.s V_5
IL_0018: brfalse.s IL_0020
IL_001a: ldloc.s V_5
IL_001c: ldlen
IL_001d: conv.i4
IL_001e: brtrue.s IL_0025
IL_0020: ldc.i4.0
IL_0021: conv.u
IL_0022: stloc.1
IL_0023: br.s IL_002e
IL_0025: ldloc.s V_5
IL_0027: ldc.i4.0
IL_0028: ldelema [mscorlib]System.Byte
IL_002d: stloc.1
IL_002e: ldloc.0
IL_002f: ldlen
IL_0030: conv.i4
IL_0031: ldloc.1
IL_0032: conv.i
IL_0033: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_0038: stloc.s V_4
IL_003a: leave.s IL_0075
IL_003c: ldarg.0
IL_003d: newarr [mscorlib]System.Byte
IL_0042: stloc.2
IL_0043: ldstr "second fixed"
IL_0048: call void [mscorlib]System.Console::WriteLine(string)
IL_004d: ldloc.2
IL_004e: dup
IL_004f: stloc.s V_6
IL_0051: brfalse.s IL_0059
IL_0053: ldloc.s V_6
IL_0055: ldlen
IL_0056: conv.i4
IL_0057: brtrue.s IL_005e
IL_0059: ldc.i4.0
IL_005a: conv.u
IL_005b: stloc.3
IL_005c: br.s IL_0067
IL_005e: ldloc.s V_6
IL_0060: ldc.i4.0
IL_0061: ldelema [mscorlib]System.Byte
IL_0066: stloc.3
IL_0067: ldloc.2
IL_0068: ldlen
IL_0069: conv.i4
IL_006a: ldloc.3
IL_006b: conv.i
IL_006c: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_0071: stloc.s V_4
IL_0073: leave.s IL_0075
IL_0075: ldloc.s V_4
IL_0077: ret
} // end of method UnsafeCode::Issue1386
.property instance int32* NullPointer()
{
.get instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::get_NullPointer()

207
ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.opt.roslyn.il

@ -43,6 +43,28 @@ @@ -43,6 +43,28 @@
.field public float64 Y
} // end of class SimpleStruct
.class sequential ansi sealed nested public beforefieldinit ResultStruct
extends [mscorlib]System.ValueType
{
.field public uint8* ptr1
.field public uint8* ptr2
.method public hidebysig specialname rtspecialname
instance void .ctor(uint8* ptr1,
uint8* ptr2) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr1
IL_0007: ldarg.0
IL_0008: ldarg.2
IL_0009: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr2
IL_000e: ret
} // end of method ResultStruct::.ctor
} // end of class ResultStruct
.class sequential ansi sealed nested public beforefieldinit StructWithFixedSizeMembers
extends [mscorlib]System.ValueType
{
@ -1176,6 +1198,191 @@ @@ -1176,6 +1198,191 @@
IL_001b: ret
} // end of method UnsafeCode::Issue1021
.method private hidebysig static !!T Get<T>() cil managed
{
// Code size 10 (0xa)
.maxstack 1
.locals init (!!T V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj !!T
IL_0008: ldloc.0
IL_0009: ret
} // end of method UnsafeCode::Get
.method private hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct
NestedFixedBlocks(uint8[] 'array') cil managed
{
// Code size 84 (0x54)
.maxstack 2
.locals init (uint8* V_0,
uint8[] pinned V_1,
uint8* V_2,
uint8[] pinned V_3,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct V_4)
.try
{
.try
{
IL_0000: ldarg.0
IL_0001: dup
IL_0002: stloc.1
IL_0003: brfalse.s IL_000a
IL_0005: ldloc.1
IL_0006: ldlen
IL_0007: conv.i4
IL_0008: brtrue.s IL_000f
IL_000a: ldc.i4.0
IL_000b: conv.u
IL_000c: stloc.0
IL_000d: br.s IL_0018
IL_000f: ldloc.1
IL_0010: ldc.i4.0
IL_0011: ldelema [mscorlib]System.Byte
IL_0016: conv.u
IL_0017: stloc.0
IL_0018: nop
.try
{
IL_0019: call !!0 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::Get<uint8[]>()
IL_001e: dup
IL_001f: stloc.3
IL_0020: brfalse.s IL_0027
IL_0022: ldloc.3
IL_0023: ldlen
IL_0024: conv.i4
IL_0025: brtrue.s IL_002c
IL_0027: ldc.i4.0
IL_0028: conv.u
IL_0029: stloc.2
IL_002a: br.s IL_0035
IL_002c: ldloc.3
IL_002d: ldc.i4.0
IL_002e: ldelema [mscorlib]System.Byte
IL_0033: conv.u
IL_0034: stloc.2
IL_0035: ldloc.0
IL_0036: ldloc.2
IL_0037: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::.ctor(uint8*,
uint8*)
IL_003c: stloc.s V_4
IL_003e: leave.s IL_0051
} // end .try
finally
{
IL_0040: ldnull
IL_0041: stloc.3
IL_0042: endfinally
} // end handler
} // end .try
finally
{
IL_0043: ldnull
IL_0044: stloc.1
IL_0045: endfinally
} // end handler
} // end .try
finally
{
IL_0046: ldstr "Finally"
IL_004b: call void [mscorlib]System.Console::WriteLine(string)
IL_0050: endfinally
} // end handler
IL_0051: ldloc.s V_4
IL_0053: ret
} // end of method UnsafeCode::NestedFixedBlocks
.method private hidebysig static object
CreateBuffer(int32 length,
uint8* ptr) cil managed
{
// Code size 6 (0x6)
.maxstack 8
IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0005: throw
} // end of method UnsafeCode::CreateBuffer
.method private hidebysig static object
Issue1386(int32 arraySize,
bool createFirstBuffer) cil managed
{
// Code size 101 (0x65)
.maxstack 3
.locals init (uint8* V_0,
uint8[] pinned V_1,
uint8* V_2)
IL_0000: ldarg.1
IL_0001: brfalse.s IL_0034
IL_0003: ldarg.0
IL_0004: newarr [mscorlib]System.Byte
IL_0009: ldstr "first fixed"
IL_000e: call void [mscorlib]System.Console::WriteLine(string)
IL_0013: dup
IL_0014: dup
IL_0015: stloc.1
IL_0016: brfalse.s IL_001d
IL_0018: ldloc.1
IL_0019: ldlen
IL_001a: conv.i4
IL_001b: brtrue.s IL_0022
IL_001d: ldc.i4.0
IL_001e: conv.u
IL_001f: stloc.0
IL_0020: br.s IL_002b
IL_0022: ldloc.1
IL_0023: ldc.i4.0
IL_0024: ldelema [mscorlib]System.Byte
IL_0029: conv.u
IL_002a: stloc.0
IL_002b: ldlen
IL_002c: conv.i4
IL_002d: ldloc.0
IL_002e: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_0033: ret
IL_0034: ldarg.0
IL_0035: newarr [mscorlib]System.Byte
IL_003a: ldstr "second fixed"
IL_003f: call void [mscorlib]System.Console::WriteLine(string)
IL_0044: dup
IL_0045: dup
IL_0046: stloc.1
IL_0047: brfalse.s IL_004e
IL_0049: ldloc.1
IL_004a: ldlen
IL_004b: conv.i4
IL_004c: brtrue.s IL_0053
IL_004e: ldc.i4.0
IL_004f: conv.u
IL_0050: stloc.2
IL_0051: br.s IL_005c
IL_0053: ldloc.1
IL_0054: ldc.i4.0
IL_0055: ldelema [mscorlib]System.Byte
IL_005a: conv.u
IL_005b: stloc.2
IL_005c: ldlen
IL_005d: conv.i4
IL_005e: ldloc.2
IL_005f: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_0064: ret
} // end of method UnsafeCode::Issue1386
.property instance int32* NullPointer()
{
.get instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::get_NullPointer()

242
ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.roslyn.il

@ -43,6 +43,29 @@ @@ -43,6 +43,29 @@
.field public float64 Y
} // end of class SimpleStruct
.class sequential ansi sealed nested public beforefieldinit ResultStruct
extends [mscorlib]System.ValueType
{
.field public uint8* ptr1
.field public uint8* ptr2
.method public hidebysig specialname rtspecialname
instance void .ctor(uint8* ptr1,
uint8* ptr2) cil managed
{
// Code size 16 (0x10)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr1
IL_0008: ldarg.0
IL_0009: ldarg.2
IL_000a: stfld uint8* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::ptr2
IL_000f: ret
} // end of method ResultStruct::.ctor
} // end of class ResultStruct
.class sequential ansi sealed nested public beforefieldinit StructWithFixedSizeMembers
extends [mscorlib]System.ValueType
{
@ -1460,6 +1483,225 @@ @@ -1460,6 +1483,225 @@
IL_001c: ret
} // end of method UnsafeCode::Issue1021
.method private hidebysig static !!T Get<T>() cil managed
{
// Code size 15 (0xf)
.maxstack 1
.locals init (!!T V_0,
!!T V_1)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: initobj !!T
IL_0009: ldloc.0
IL_000a: stloc.1
IL_000b: br.s IL_000d
IL_000d: ldloc.1
IL_000e: ret
} // end of method UnsafeCode::Get
.method private hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct
NestedFixedBlocks(uint8[] 'array') cil managed
{
// Code size 90 (0x5a)
.maxstack 2
.locals init (uint8* V_0,
uint8[] pinned V_1,
uint8* V_2,
uint8[] pinned V_3,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct V_4)
IL_0000: nop
.try
{
IL_0001: nop
.try
{
IL_0002: ldarg.0
IL_0003: dup
IL_0004: stloc.1
IL_0005: brfalse.s IL_000c
IL_0007: ldloc.1
IL_0008: ldlen
IL_0009: conv.i4
IL_000a: brtrue.s IL_0011
IL_000c: ldc.i4.0
IL_000d: conv.u
IL_000e: stloc.0
IL_000f: br.s IL_001a
IL_0011: ldloc.1
IL_0012: ldc.i4.0
IL_0013: ldelema [mscorlib]System.Byte
IL_0018: conv.u
IL_0019: stloc.0
IL_001a: nop
.try
{
IL_001b: call !!0 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::Get<uint8[]>()
IL_0020: dup
IL_0021: stloc.3
IL_0022: brfalse.s IL_0029
IL_0024: ldloc.3
IL_0025: ldlen
IL_0026: conv.i4
IL_0027: brtrue.s IL_002e
IL_0029: ldc.i4.0
IL_002a: conv.u
IL_002b: stloc.2
IL_002c: br.s IL_0037
IL_002e: ldloc.3
IL_002f: ldc.i4.0
IL_0030: ldelema [mscorlib]System.Byte
IL_0035: conv.u
IL_0036: stloc.2
IL_0037: nop
IL_0038: ldloc.0
IL_0039: ldloc.2
IL_003a: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/ResultStruct::.ctor(uint8*,
uint8*)
IL_003f: stloc.s V_4
IL_0041: leave.s IL_0057
} // end .try
finally
{
IL_0043: ldnull
IL_0044: stloc.3
IL_0045: endfinally
} // end handler
} // end .try
finally
{
IL_0046: ldnull
IL_0047: stloc.1
IL_0048: endfinally
} // end handler
} // end .try
finally
{
IL_0049: nop
IL_004a: ldstr "Finally"
IL_004f: call void [mscorlib]System.Console::WriteLine(string)
IL_0054: nop
IL_0055: nop
IL_0056: endfinally
} // end handler
IL_0057: ldloc.s V_4
IL_0059: ret
} // end of method UnsafeCode::NestedFixedBlocks
.method private hidebysig static object
CreateBuffer(int32 length,
uint8* ptr) 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 UnsafeCode::CreateBuffer
.method private hidebysig static object
Issue1386(int32 arraySize,
bool createFirstBuffer) cil managed
{
// Code size 131 (0x83)
.maxstack 2
.locals init (uint8[] V_0,
bool V_1,
uint8[] V_2,
uint8* V_3,
uint8[] pinned V_4,
object V_5,
uint8* V_6)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: stloc.1
IL_0003: ldloc.1
IL_0004: brfalse.s IL_0042
IL_0006: nop
IL_0007: ldarg.0
IL_0008: newarr [mscorlib]System.Byte
IL_000d: stloc.2
IL_000e: ldstr "first fixed"
IL_0013: call void [mscorlib]System.Console::WriteLine(string)
IL_0018: nop
IL_0019: ldloc.2
IL_001a: dup
IL_001b: stloc.s V_4
IL_001d: brfalse.s IL_0025
IL_001f: ldloc.s V_4
IL_0021: ldlen
IL_0022: conv.i4
IL_0023: brtrue.s IL_002a
IL_0025: ldc.i4.0
IL_0026: conv.u
IL_0027: stloc.3
IL_0028: br.s IL_0034
IL_002a: ldloc.s V_4
IL_002c: ldc.i4.0
IL_002d: ldelema [mscorlib]System.Byte
IL_0032: conv.u
IL_0033: stloc.3
IL_0034: nop
IL_0035: ldloc.2
IL_0036: ldlen
IL_0037: conv.i4
IL_0038: ldloc.3
IL_0039: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_003e: stloc.s V_5
IL_0040: br.s IL_0080
IL_0042: ldarg.0
IL_0043: newarr [mscorlib]System.Byte
IL_0048: stloc.0
IL_0049: ldstr "second fixed"
IL_004e: call void [mscorlib]System.Console::WriteLine(string)
IL_0053: nop
IL_0054: ldloc.0
IL_0055: dup
IL_0056: stloc.s V_4
IL_0058: brfalse.s IL_0060
IL_005a: ldloc.s V_4
IL_005c: ldlen
IL_005d: conv.i4
IL_005e: brtrue.s IL_0066
IL_0060: ldc.i4.0
IL_0061: conv.u
IL_0062: stloc.s V_6
IL_0064: br.s IL_0071
IL_0066: ldloc.s V_4
IL_0068: ldc.i4.0
IL_0069: ldelema [mscorlib]System.Byte
IL_006e: conv.u
IL_006f: stloc.s V_6
IL_0071: nop
IL_0072: ldloc.0
IL_0073: ldlen
IL_0074: conv.i4
IL_0075: ldloc.s V_6
IL_0077: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::CreateBuffer(int32,
uint8*)
IL_007c: stloc.s V_5
IL_007e: br.s IL_0080
IL_0080: ldloc.s V_5
IL_0082: ret
} // end of method UnsafeCode::Issue1386
.property instance int32* NullPointer()
{
.get instance int32* ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::get_NullPointer()

186
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs

@ -0,0 +1,186 @@ @@ -0,0 +1,186 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public static class ValueTypes
{
public struct S
{
public int Field;
public S(int field)
{
Field = field;
}
public void SetField()
{
Field = 5;
}
public void MethodCalls()
{
SetField();
Test(this);
Test(ref this);
}
private static void Test(S byVal)
{
}
private static void Test(ref S byRef)
{
}
}
private static readonly S ReadOnlyS = default(S);
private static S MutableS = default(S);
private static volatile int VolatileInt;
public static void CallMethodViaField()
{
ReadOnlyS.SetField();
MutableS.SetField();
S mutableS = MutableS;
mutableS.SetField();
}
public static S InitObj1()
{
S result = default(S);
MakeArray();
return result;
}
public static S InitObj2()
{
return default(S);
}
public static void InitObj3(out S p)
{
p = default(S);
}
public static S CallValueTypeCtor1()
{
return new S(10);
}
public static S CallValueTypeCtor2()
{
S result = new S(10);
return result;
}
public static S Copy1(S p)
{
return p;
}
public static S Copy2(ref S p)
{
return p;
}
public static void Copy3(S p, out S o)
{
o = p;
}
public static void Copy4(ref S p, out S o)
{
o = p;
}
public static void Copy4b(ref S p, out S o)
{
// test passing through by-ref arguments
Copy4(ref p, out o);
}
public static void Issue56(int i, out string str)
{
str = "qq";
str += i.ToString();
}
public static void CopyAroundAndModifyField(S s)
{
S s2 = s;
s2.Field += 10;
s = s2;
}
private static int[] MakeArray()
{
return null;
}
public static void IncrementArrayLocation()
{
MakeArray()[Environment.TickCount]++;
}
public static bool Is(object obj)
{
return obj is S;
}
public static bool IsNullable(object obj)
{
return obj is S?;
}
public static S? As(object obj)
{
return obj as S?;
}
public static S OnlyChangeTheCopy(S p)
{
S s = p;
s.SetField();
return p;
}
public static void UseRefBoolInCondition(ref bool x)
{
if (x) {
Console.WriteLine("true");
}
}
public static void CompareNotEqual0IsReallyNotEqual(IComparable<int> a)
{
if (a.CompareTo(0) != 0) {
Console.WriteLine("true");
}
}
public static void CompareEqual0IsReallyEqual(IComparable<int> a)
{
if (a.CompareTo(0) == 0) {
Console.WriteLine("true");
}
}
}
}

511
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.il

@ -0,0 +1,511 @@ @@ -0,0 +1,511 @@
// 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 ValueTypes
{
.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.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ValueTypes.dll
.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 abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit S
extends [mscorlib]System.ValueType
{
.field public int32 Field
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 'field') cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0008: ret
} // end of method S::.ctor
.method public hidebysig instance void
SetField() cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.5
IL_0003: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0008: ret
} // end of method S::SetField
.method public hidebysig instance void
MethodCalls() cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0007: nop
IL_0008: ldarg.0
IL_0009: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000e: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S)
IL_0013: nop
IL_0014: ldarg.0
IL_0015: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_001a: nop
IL_001b: ret
} // end of method S::MethodCalls
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S byVal) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method S::Test
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& byRef) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method S::Test
} // end of class S
.field private static initonly valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ReadOnlyS
.field private static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S MutableS
.field private static int32 modreq([mscorlib]System.Runtime.CompilerServices.IsVolatile) VolatileInt
.method public hidebysig static void CallMethodViaField() cil managed
{
// Code size 41 (0x29)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::ReadOnlyS
IL_0006: stloc.1
IL_0007: ldloca.s V_1
IL_0009: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_000e: nop
IL_000f: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_0014: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0019: nop
IL_001a: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_001f: stloc.0
IL_0020: ldloca.s V_0
IL_0022: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0027: nop
IL_0028: ret
} // end of method ValueTypes::CallMethodViaField
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj1() cil managed
{
// Code size 21 (0x15)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0009: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_000e: pop
IL_000f: ldloc.0
IL_0010: stloc.1
IL_0011: br.s IL_0013
IL_0013: ldloc.1
IL_0014: ret
} // end of method ValueTypes::InitObj1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj2() cil managed
{
// Code size 15 (0xf)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldloca.s V_1
IL_0003: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0009: ldloc.1
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method ValueTypes::InitObj2
.method public hidebysig static void InitObj3([out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: ret
} // end of method ValueTypes::InitObj3
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor1() cil managed
{
// Code size 13 (0xd)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: nop
IL_0001: ldc.i4.s 10
IL_0003: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_0008: stloc.0
IL_0009: br.s IL_000b
IL_000b: ldloc.0
IL_000c: ret
} // end of method ValueTypes::CallValueTypeCtor1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor2() cil managed
{
// Code size 17 (0x11)
.maxstack 2
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: ldc.i4.s 10
IL_0005: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_000a: nop
IL_000b: ldloc.0
IL_000c: stloc.1
IL_000d: br.s IL_000f
IL_000f: ldloc.1
IL_0010: ret
} // end of method ValueTypes::CallValueTypeCtor2
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy1(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S 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 ValueTypes::Copy1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy2(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method ValueTypes::Copy2
.method public hidebysig static void Copy3(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.0
IL_0003: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: ret
} // end of method ValueTypes::Copy3
.method public hidebysig static void Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.0
IL_0003: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000d: ret
} // end of method ValueTypes::Copy4
.method public hidebysig static void Copy4b(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_0008: nop
IL_0009: ret
} // end of method ValueTypes::Copy4b
.method public hidebysig static void Issue56(int32 i,
[out] string& str) cil managed
{
// Code size 25 (0x19)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldstr "qq"
IL_0007: stind.ref
IL_0008: ldarg.1
IL_0009: dup
IL_000a: ldind.ref
IL_000b: ldarga.s i
IL_000d: call instance string [mscorlib]System.Int32::ToString()
IL_0012: call string [mscorlib]System.String::Concat(string,
string)
IL_0017: stind.ref
IL_0018: ret
} // end of method ValueTypes::Issue56
.method public hidebysig static void CopyAroundAndModifyField(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S s) cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: stloc.0
IL_0003: ldloca.s V_0
IL_0005: dup
IL_0006: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_000b: ldc.i4.s 10
IL_000d: add
IL_000e: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0013: ldloc.0
IL_0014: starg.s s
IL_0016: ret
} // end of method ValueTypes::CopyAroundAndModifyField
.method private hidebysig static int32[]
MakeArray() cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldnull
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method ValueTypes::MakeArray
.method public hidebysig static void IncrementArrayLocation() cil managed
{
// Code size 30 (0x1e)
.maxstack 8
IL_0000: nop
IL_0001: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_0006: call int32 [mscorlib]System.Environment::get_TickCount()
IL_000b: ldelema [mscorlib]System.Int32
IL_0010: dup
IL_0011: ldobj [mscorlib]System.Int32
IL_0016: ldc.i4.1
IL_0017: add
IL_0018: stobj [mscorlib]System.Int32
IL_001d: ret
} // end of method ValueTypes::IncrementArrayLocation
.method public hidebysig static bool Is(object obj) cil managed
{
// Code size 15 (0xf)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: ldnull
IL_0008: cgt.un
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method ValueTypes::Is
.method public hidebysig static bool IsNullable(object obj) cil managed
{
// Code size 15 (0xf)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0007: ldnull
IL_0008: cgt.un
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method ValueTypes::IsNullable
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
As(object obj) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0007: unbox.any valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method ValueTypes::As
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
OnlyChangeTheCopy(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: stloc.0
IL_0003: ldloca.s V_0
IL_0005: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_000a: nop
IL_000b: ldarg.0
IL_000c: stloc.1
IL_000d: br.s IL_000f
IL_000f: ldloc.1
IL_0010: ret
} // end of method ValueTypes::OnlyChangeTheCopy
.method public hidebysig static void UseRefBoolInCondition(bool& x) cil managed
{
// Code size 24 (0x18)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldind.i1
IL_0003: ldc.i4.0
IL_0004: ceq
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: brtrue.s IL_0017
IL_000a: nop
IL_000b: ldstr "true"
IL_0010: call void [mscorlib]System.Console::WriteLine(string)
IL_0015: nop
IL_0016: nop
IL_0017: ret
} // end of method ValueTypes::UseRefBoolInCondition
.method public hidebysig static void CompareNotEqual0IsReallyNotEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 29 (0x1d)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.0
IL_0003: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0008: ldc.i4.0
IL_0009: ceq
IL_000b: stloc.0
IL_000c: ldloc.0
IL_000d: brtrue.s IL_001c
IL_000f: nop
IL_0010: ldstr "true"
IL_0015: call void [mscorlib]System.Console::WriteLine(string)
IL_001a: nop
IL_001b: nop
IL_001c: ret
} // end of method ValueTypes::CompareNotEqual0IsReallyNotEqual
.method public hidebysig static void CompareEqual0IsReallyEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 32 (0x20)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.0
IL_0003: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0008: ldc.i4.0
IL_0009: ceq
IL_000b: ldc.i4.0
IL_000c: ceq
IL_000e: stloc.0
IL_000f: ldloc.0
IL_0010: brtrue.s IL_001f
IL_0012: nop
IL_0013: ldstr "true"
IL_0018: call void [mscorlib]System.Console::WriteLine(string)
IL_001d: nop
IL_001e: nop
IL_001f: ret
} // end of method ValueTypes::CompareEqual0IsReallyEqual
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::ReadOnlyS
IL_0005: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000b: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_0010: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0016: ret
} // end of method ValueTypes::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

394
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.opt.il

@ -0,0 +1,394 @@ @@ -0,0 +1,394 @@
// 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 ValueTypes.opt
{
.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.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ValueTypes.opt.dll
.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 abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit S
extends [mscorlib]System.ValueType
{
.field public int32 Field
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 'field') cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0007: ret
} // end of method S::.ctor
.method public hidebysig instance void
SetField() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.5
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0007: ret
} // end of method S::SetField
.method public hidebysig instance void
MethodCalls() cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0006: ldarg.0
IL_0007: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000c: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S)
IL_0011: ldarg.0
IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_0017: ret
} // end of method S::MethodCalls
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S byVal) cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method S::Test
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& byRef) cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method S::Test
} // end of class S
.field private static initonly valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ReadOnlyS
.field private static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S MutableS
.field private static int32 modreq([mscorlib]System.Runtime.CompilerServices.IsVolatile) VolatileInt
.method public hidebysig static void CallMethodViaField() cil managed
{
// Code size 37 (0x25)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::ReadOnlyS
IL_0005: stloc.1
IL_0006: ldloca.s V_1
IL_0008: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_000d: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_0012: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0017: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_001c: stloc.0
IL_001d: ldloca.s V_0
IL_001f: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0024: ret
} // end of method ValueTypes::CallMethodViaField
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj1() cil managed
{
// Code size 16 (0x10)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_000d: pop
IL_000e: ldloc.0
IL_000f: ret
} // end of method ValueTypes::InitObj1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj2() cil managed
{
// Code size 10 (0xa)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: ldloc.0
IL_0009: ret
} // end of method ValueTypes::InitObj2
.method public hidebysig static void InitObj3([out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: ret
} // end of method ValueTypes::InitObj3
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor1() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.s 10
IL_0002: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_0007: ret
} // end of method ValueTypes::CallValueTypeCtor1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor2() cil managed
{
// Code size 11 (0xb)
.maxstack 2
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldloca.s V_0
IL_0002: ldc.i4.s 10
IL_0004: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_0009: ldloc.0
IL_000a: ret
} // end of method ValueTypes::CallValueTypeCtor2
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy1(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ret
} // end of method ValueTypes::Copy1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy2(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0006: ret
} // end of method ValueTypes::Copy2
.method public hidebysig static void Copy3(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.0
IL_0002: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: ret
} // end of method ValueTypes::Copy3
.method public hidebysig static void Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.0
IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000c: ret
} // end of method ValueTypes::Copy4
.method public hidebysig static void Copy4b(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_0007: ret
} // end of method ValueTypes::Copy4b
.method public hidebysig static void Issue56(int32 i,
[out] string& str) cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldstr "qq"
IL_0006: stind.ref
IL_0007: ldarg.1
IL_0008: dup
IL_0009: ldind.ref
IL_000a: ldarga.s i
IL_000c: call instance string [mscorlib]System.Int32::ToString()
IL_0011: call string [mscorlib]System.String::Concat(string,
string)
IL_0016: stind.ref
IL_0017: ret
} // end of method ValueTypes::Issue56
.method public hidebysig static void CopyAroundAndModifyField(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S s) cil managed
{
// Code size 22 (0x16)
.maxstack 3
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: dup
IL_0005: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_000a: ldc.i4.s 10
IL_000c: add
IL_000d: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0012: ldloc.0
IL_0013: starg.s s
IL_0015: ret
} // end of method ValueTypes::CopyAroundAndModifyField
.method private hidebysig static int32[]
MakeArray() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldnull
IL_0001: ret
} // end of method ValueTypes::MakeArray
.method public hidebysig static void IncrementArrayLocation() cil managed
{
// Code size 29 (0x1d)
.maxstack 8
IL_0000: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_0005: call int32 [mscorlib]System.Environment::get_TickCount()
IL_000a: ldelema [mscorlib]System.Int32
IL_000f: dup
IL_0010: ldobj [mscorlib]System.Int32
IL_0015: ldc.i4.1
IL_0016: add
IL_0017: stobj [mscorlib]System.Int32
IL_001c: ret
} // end of method ValueTypes::IncrementArrayLocation
.method public hidebysig static bool Is(object obj) cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldarg.0
IL_0001: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0006: ldnull
IL_0007: cgt.un
IL_0009: ret
} // end of method ValueTypes::Is
.method public hidebysig static bool IsNullable(object obj) cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldarg.0
IL_0001: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0006: ldnull
IL_0007: cgt.un
IL_0009: ret
} // end of method ValueTypes::IsNullable
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
As(object obj) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0006: unbox.any valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_000b: ret
} // end of method ValueTypes::As
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
OnlyChangeTheCopy(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0009: ldarg.0
IL_000a: ret
} // end of method ValueTypes::OnlyChangeTheCopy
.method public hidebysig static void UseRefBoolInCondition(bool& x) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldind.i1
IL_0002: brfalse.s IL_000e
IL_0004: ldstr "true"
IL_0009: call void [mscorlib]System.Console::WriteLine(string)
IL_000e: ret
} // end of method ValueTypes::UseRefBoolInCondition
.method public hidebysig static void CompareNotEqual0IsReallyNotEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0007: brfalse.s IL_0013
IL_0009: ldstr "true"
IL_000e: call void [mscorlib]System.Console::WriteLine(string)
IL_0013: ret
} // end of method ValueTypes::CompareNotEqual0IsReallyNotEqual
.method public hidebysig static void CompareEqual0IsReallyEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0007: brtrue.s IL_0013
IL_0009: ldstr "true"
IL_000e: call void [mscorlib]System.Console::WriteLine(string)
IL_0013: ret
} // end of method ValueTypes::CompareEqual0IsReallyEqual
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::ReadOnlyS
IL_0005: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000b: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_0010: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0016: ret
} // end of method ValueTypes::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

392
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.opt.roslyn.il

@ -0,0 +1,392 @@ @@ -0,0 +1,392 @@
// 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 ValueTypes
{
.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 ValueTypes.dll
.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 abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit S
extends [mscorlib]System.ValueType
{
.field public int32 Field
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 'field') cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0007: ret
} // end of method S::.ctor
.method public hidebysig instance void
SetField() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.5
IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0007: ret
} // end of method S::SetField
.method public hidebysig instance void
MethodCalls() cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0006: ldarg.0
IL_0007: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000c: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S)
IL_0011: ldarg.0
IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_0017: ret
} // end of method S::MethodCalls
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S byVal) cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method S::Test
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& byRef) cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method S::Test
} // end of class S
.field private static initonly valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ReadOnlyS
.field private static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S MutableS
.field private static int32 modreq([mscorlib]System.Runtime.CompilerServices.IsVolatile) VolatileInt
.method public hidebysig static void CallMethodViaField() cil managed
{
// Code size 37 (0x25)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::ReadOnlyS
IL_0005: stloc.1
IL_0006: ldloca.s V_1
IL_0008: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_000d: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_0012: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0017: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_001c: stloc.0
IL_001d: ldloca.s V_0
IL_001f: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0024: ret
} // end of method ValueTypes::CallMethodViaField
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj1() cil managed
{
// Code size 16 (0x10)
.maxstack 2
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: ldloc.0
IL_0009: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_000e: pop
IL_000f: ret
} // end of method ValueTypes::InitObj1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj2() cil managed
{
// Code size 10 (0xa)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldloca.s V_0
IL_0002: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: ldloc.0
IL_0009: ret
} // end of method ValueTypes::InitObj2
.method public hidebysig static void InitObj3([out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: ret
} // end of method ValueTypes::InitObj3
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor1() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.s 10
IL_0002: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_0007: ret
} // end of method ValueTypes::CallValueTypeCtor1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor2() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.s 10
IL_0002: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_0007: ret
} // end of method ValueTypes::CallValueTypeCtor2
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy1(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ret
} // end of method ValueTypes::Copy1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy2(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0006: ret
} // end of method ValueTypes::Copy2
.method public hidebysig static void Copy3(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.0
IL_0002: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: ret
} // end of method ValueTypes::Copy3
.method public hidebysig static void Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldarg.0
IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000c: ret
} // end of method ValueTypes::Copy4
.method public hidebysig static void Copy4b(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_0007: ret
} // end of method ValueTypes::Copy4b
.method public hidebysig static void Issue56(int32 i,
[out] string& str) cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldstr "qq"
IL_0006: stind.ref
IL_0007: ldarg.1
IL_0008: ldarg.1
IL_0009: ldind.ref
IL_000a: ldarga.s i
IL_000c: call instance string [mscorlib]System.Int32::ToString()
IL_0011: call string [mscorlib]System.String::Concat(string,
string)
IL_0016: stind.ref
IL_0017: ret
} // end of method ValueTypes::Issue56
.method public hidebysig static void CopyAroundAndModifyField(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S s) cil managed
{
// Code size 19 (0x13)
.maxstack 3
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0009: dup
IL_000a: ldind.i4
IL_000b: ldc.i4.s 10
IL_000d: add
IL_000e: stind.i4
IL_000f: ldloc.0
IL_0010: starg.s s
IL_0012: ret
} // end of method ValueTypes::CopyAroundAndModifyField
.method private hidebysig static int32[]
MakeArray() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: ldnull
IL_0001: ret
} // end of method ValueTypes::MakeArray
.method public hidebysig static void IncrementArrayLocation() cil managed
{
// Code size 21 (0x15)
.maxstack 8
IL_0000: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_0005: call int32 [mscorlib]System.Environment::get_TickCount()
IL_000a: ldelema [mscorlib]System.Int32
IL_000f: dup
IL_0010: ldind.i4
IL_0011: ldc.i4.1
IL_0012: add
IL_0013: stind.i4
IL_0014: ret
} // end of method ValueTypes::IncrementArrayLocation
.method public hidebysig static bool Is(object obj) cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldarg.0
IL_0001: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0006: ldnull
IL_0007: cgt.un
IL_0009: ret
} // end of method ValueTypes::Is
.method public hidebysig static bool IsNullable(object obj) cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: ldarg.0
IL_0001: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0006: ldnull
IL_0007: cgt.un
IL_0009: ret
} // end of method ValueTypes::IsNullable
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
As(object obj) cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0006: unbox.any valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_000b: ret
} // end of method ValueTypes::As
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
OnlyChangeTheCopy(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 11 (0xb)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: ldarg.0
IL_0001: stloc.0
IL_0002: ldloca.s V_0
IL_0004: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0009: ldarg.0
IL_000a: ret
} // end of method ValueTypes::OnlyChangeTheCopy
.method public hidebysig static void UseRefBoolInCondition(bool& x) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldind.u1
IL_0002: brfalse.s IL_000e
IL_0004: ldstr "true"
IL_0009: call void [mscorlib]System.Console::WriteLine(string)
IL_000e: ret
} // end of method ValueTypes::UseRefBoolInCondition
.method public hidebysig static void CompareNotEqual0IsReallyNotEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0007: brfalse.s IL_0013
IL_0009: ldstr "true"
IL_000e: call void [mscorlib]System.Console::WriteLine(string)
IL_0013: ret
} // end of method ValueTypes::CompareNotEqual0IsReallyNotEqual
.method public hidebysig static void CompareEqual0IsReallyEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.0
IL_0002: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0007: brtrue.s IL_0013
IL_0009: ldstr "true"
IL_000e: call void [mscorlib]System.Console::WriteLine(string)
IL_0013: ret
} // end of method ValueTypes::CompareEqual0IsReallyEqual
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method ValueTypes::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

511
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.roslyn.il

@ -0,0 +1,511 @@ @@ -0,0 +1,511 @@
// 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 ValueTypes
{
.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 ValueTypes.dll
.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 abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit S
extends [mscorlib]System.ValueType
{
.field public int32 Field
.method public hidebysig specialname rtspecialname
instance void .ctor(int32 'field') cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0008: ret
} // end of method S::.ctor
.method public hidebysig instance void
SetField() cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.5
IL_0003: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_0008: ret
} // end of method S::SetField
.method public hidebysig instance void
MethodCalls() cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0007: nop
IL_0008: ldarg.0
IL_0009: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000e: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S)
IL_0013: nop
IL_0014: ldarg.0
IL_0015: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_001a: nop
IL_001b: ret
} // end of method S::MethodCalls
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S byVal) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method S::Test
.method private hidebysig static void
Test(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& byRef) cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method S::Test
} // end of class S
.field private static initonly valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ReadOnlyS
.field private static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S MutableS
.field private static int32 modreq([mscorlib]System.Runtime.CompilerServices.IsVolatile) VolatileInt
.method public hidebysig static void CallMethodViaField() cil managed
{
// Code size 41 (0x29)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::ReadOnlyS
IL_0006: stloc.1
IL_0007: ldloca.s V_1
IL_0009: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_000e: nop
IL_000f: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_0014: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0019: nop
IL_001a: ldsfld valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_001f: stloc.0
IL_0020: ldloca.s V_0
IL_0022: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_0027: nop
IL_0028: ret
} // end of method ValueTypes::CallMethodViaField
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj1() cil managed
{
// Code size 21 (0x15)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0009: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_000e: pop
IL_000f: ldloc.0
IL_0010: stloc.1
IL_0011: br.s IL_0013
IL_0013: ldloc.1
IL_0014: ret
} // end of method ValueTypes::InitObj1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
InitObj2() cil managed
{
// Code size 15 (0xf)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0009: ldloc.0
IL_000a: stloc.1
IL_000b: br.s IL_000d
IL_000d: ldloc.1
IL_000e: ret
} // end of method ValueTypes::InitObj2
.method public hidebysig static void InitObj3([out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: ret
} // end of method ValueTypes::InitObj3
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor1() cil managed
{
// Code size 13 (0xd)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: nop
IL_0001: ldc.i4.s 10
IL_0003: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_0008: stloc.0
IL_0009: br.s IL_000b
IL_000b: ldloc.0
IL_000c: ret
} // end of method ValueTypes::CallValueTypeCtor1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
CallValueTypeCtor2() cil managed
{
// Code size 16 (0x10)
.maxstack 2
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldloca.s V_0
IL_0003: ldc.i4.s 10
IL_0005: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::.ctor(int32)
IL_000a: ldloc.0
IL_000b: stloc.1
IL_000c: br.s IL_000e
IL_000e: ldloc.1
IL_000f: ret
} // end of method ValueTypes::CallValueTypeCtor2
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy1(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S 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 ValueTypes::Copy1
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
Copy2(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p) cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method ValueTypes::Copy2
.method public hidebysig static void Copy3(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.0
IL_0003: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: ret
} // end of method ValueTypes::Copy3
.method public hidebysig static void Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 14 (0xe)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldarg.0
IL_0003: ldobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0008: stobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000d: ret
} // end of method ValueTypes::Copy4
.method public hidebysig static void Copy4b(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& p,
[out] valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S& o) cil managed
{
// Code size 10 (0xa)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::Copy4(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S&)
IL_0008: nop
IL_0009: ret
} // end of method ValueTypes::Copy4b
.method public hidebysig static void Issue56(int32 i,
[out] string& str) cil managed
{
// Code size 25 (0x19)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldstr "qq"
IL_0007: stind.ref
IL_0008: ldarg.1
IL_0009: ldarg.1
IL_000a: ldind.ref
IL_000b: ldarga.s i
IL_000d: call instance string [mscorlib]System.Int32::ToString()
IL_0012: call string [mscorlib]System.String::Concat(string,
string)
IL_0017: stind.ref
IL_0018: ret
} // end of method ValueTypes::Issue56
.method public hidebysig static void CopyAroundAndModifyField(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S s) cil managed
{
// Code size 20 (0x14)
.maxstack 3
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: stloc.0
IL_0003: ldloca.s V_0
IL_0005: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::Field
IL_000a: dup
IL_000b: ldind.i4
IL_000c: ldc.i4.s 10
IL_000e: add
IL_000f: stind.i4
IL_0010: ldloc.0
IL_0011: starg.s s
IL_0013: ret
} // end of method ValueTypes::CopyAroundAndModifyField
.method private hidebysig static int32[]
MakeArray() cil managed
{
// Code size 7 (0x7)
.maxstack 1
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldnull
IL_0002: stloc.0
IL_0003: br.s IL_0005
IL_0005: ldloc.0
IL_0006: ret
} // end of method ValueTypes::MakeArray
.method public hidebysig static void IncrementArrayLocation() cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: nop
IL_0001: call int32[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MakeArray()
IL_0006: call int32 [mscorlib]System.Environment::get_TickCount()
IL_000b: ldelema [mscorlib]System.Int32
IL_0010: dup
IL_0011: ldind.i4
IL_0012: ldc.i4.1
IL_0013: add
IL_0014: stind.i4
IL_0015: ret
} // end of method ValueTypes::IncrementArrayLocation
.method public hidebysig static bool Is(object obj) cil managed
{
// Code size 15 (0xf)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: isinst ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0007: ldnull
IL_0008: cgt.un
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method ValueTypes::Is
.method public hidebysig static bool IsNullable(object obj) cil managed
{
// Code size 15 (0xf)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0007: ldnull
IL_0008: cgt.un
IL_000a: stloc.0
IL_000b: br.s IL_000d
IL_000d: ldloc.0
IL_000e: ret
} // end of method ValueTypes::IsNullable
.method public hidebysig static valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
As(object obj) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S> V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: isinst valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_0007: unbox.any valuetype [mscorlib]System.Nullable`1<valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S>
IL_000c: stloc.0
IL_000d: br.s IL_000f
IL_000f: ldloc.0
IL_0010: ret
} // end of method ValueTypes::As
.method public hidebysig static valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
OnlyChangeTheCopy(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S p) cil managed
{
// Code size 17 (0x11)
.maxstack 1
.locals init (valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_0,
valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: stloc.0
IL_0003: ldloca.s V_0
IL_0005: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S::SetField()
IL_000a: nop
IL_000b: ldarg.0
IL_000c: stloc.1
IL_000d: br.s IL_000f
IL_000f: ldloc.1
IL_0010: ret
} // end of method ValueTypes::OnlyChangeTheCopy
.method public hidebysig static void UseRefBoolInCondition(bool& x) cil managed
{
// Code size 21 (0x15)
.maxstack 1
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldind.u1
IL_0003: stloc.0
IL_0004: ldloc.0
IL_0005: brfalse.s IL_0014
IL_0007: nop
IL_0008: ldstr "true"
IL_000d: call void [mscorlib]System.Console::WriteLine(string)
IL_0012: nop
IL_0013: nop
IL_0014: ret
} // end of method ValueTypes::UseRefBoolInCondition
.method public hidebysig static void CompareNotEqual0IsReallyNotEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 29 (0x1d)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.0
IL_0003: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0008: ldc.i4.0
IL_0009: cgt.un
IL_000b: stloc.0
IL_000c: ldloc.0
IL_000d: brfalse.s IL_001c
IL_000f: nop
IL_0010: ldstr "true"
IL_0015: call void [mscorlib]System.Console::WriteLine(string)
IL_001a: nop
IL_001b: nop
IL_001c: ret
} // end of method ValueTypes::CompareNotEqual0IsReallyNotEqual
.method public hidebysig static void CompareEqual0IsReallyEqual(class [mscorlib]System.IComparable`1<int32> a) cil managed
{
// Code size 29 (0x1d)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.0
IL_0003: callvirt instance int32 class [mscorlib]System.IComparable`1<int32>::CompareTo(!0)
IL_0008: ldc.i4.0
IL_0009: ceq
IL_000b: stloc.0
IL_000c: ldloc.0
IL_000d: brfalse.s IL_001c
IL_000f: nop
IL_0010: ldstr "true"
IL_0015: call void [mscorlib]System.Console::WriteLine(string)
IL_001a: nop
IL_001b: nop
IL_001c: ret
} // end of method ValueTypes::CompareEqual0IsReallyEqual
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 23 (0x17)
.maxstack 8
IL_0000: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::ReadOnlyS
IL_0005: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_000b: ldsflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes::MutableS
IL_0010: initobj ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes/S
IL_0016: ret
} // end of method ValueTypes::.cctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ValueTypes
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

14
ICSharpCode.Decompiler.Tests/TestCases/Ugly/NoArrayInitializers.Expected.cs

@ -7,17 +7,17 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Ugly @@ -7,17 +7,17 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Ugly
{
public int[] LiteralArray()
{
int[] obj = new int[3];
RuntimeHelpers.InitializeArray(obj, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return obj;
int[] array = new int[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
return array;
}
public int[] VariableArray(int a, int b)
{
int[] obj = new int[2];
obj[0] = a;
obj[1] = b;
return obj;
int[] array = new int[2];
array[0] = a;
array[1] = b;
return array;
}
}
}

18
ICSharpCode.Decompiler.Tests/Types/EnumTests.cs

@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace ICSharpCode.Decompiler.Tests.Types
{
[TestFixture]
public class EnumTests : DecompilerTestBase
{
[Test]
public void EnumSamples()
{
ValidateFileRoundtrip(@"Types\S_EnumSamples.cs");
}
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save