Browse Source

Merge branch 'master' of https://github.com/icsharpcode/ILSpy into dynamic

pull/1165/head
Siegfried Pammer 7 years ago
parent
commit
f82b523217
  1. 16
      ICSharpCode.Decompiler.Tests/Helpers/RemoveCompilerAttribute.cs
  2. 13
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  3. 9
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  4. 18
      ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
  5. 6
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  6. 1507
      ICSharpCode.Decompiler.Tests/Semantics/ConversionTests.cs
  7. 940
      ICSharpCode.Decompiler.Tests/Semantics/ExplicitConversionTest.cs
  8. 32
      ICSharpCode.Decompiler.Tests/Semantics/OverloadResolutionTests.cs
  9. 64
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/CompoundAssignment.cs
  10. 22
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/MemberLookup.cs
  11. 412
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Debug.cs
  12. 1425
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Debug.il
  13. 412
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Release.cs
  14. 1325
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Release.il
  15. 12
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1145.cs
  16. 83
      ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1145.il
  17. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.il
  18. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.opt.il
  19. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Async.il
  20. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Async.opt.il
  21. 11
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.cs
  22. 32
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.opt.roslyn.il
  23. 33
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.roslyn.il
  24. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CheckedUnchecked.il
  25. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CheckedUnchecked.opt.il
  26. 4016
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.cs
  27. 22399
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.il
  28. 20649
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.il
  29. 23889
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.opt.roslyn.il
  30. 26307
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CompoundAssignmentTest.roslyn.il
  31. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/DelegateConstruction.il
  32. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/DelegateConstruction.opt.il
  33. 8
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.cs
  34. 32
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.il
  35. 28
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.il
  36. 19
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.roslyn.il
  37. 23
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.roslyn.il
  38. 2
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.cs
  39. 21
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.il
  40. 21
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.opt.il
  41. 170
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.opt.roslyn.il
  42. 170
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.roslyn.il
  43. 2
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.cs
  44. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.il
  45. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.opt.il
  46. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.il
  47. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Generics.opt.il
  48. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/HelloWorld.il
  49. 21
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs
  50. 77
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.il
  51. 71
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.il
  52. 86
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.roslyn.il
  53. 92
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.roslyn.il
  54. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InlineAssignmentTest.il
  55. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InlineAssignmentTest.opt.il
  56. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/LiftedOperators.il
  57. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/LiftedOperators.opt.il
  58. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.il
  59. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.mcs.il
  60. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.opt.il
  61. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.opt.mcs.il
  62. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il
  63. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.mcs.il
  64. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il
  65. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.mcs.il
  66. 3
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.il
  67. 3
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.opt.il
  68. 1
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.opt.roslyn.il
  69. 1
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.roslyn.il
  70. 13
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.cs
  71. 96
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.il
  72. 90
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.il
  73. 27
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.opt.roslyn.il
  74. 27
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/PropertiesAndEvents.roslyn.il
  75. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ShortCircuit.il
  76. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ShortCircuit.opt.il
  77. 31
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.il
  78. 31
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.il
  79. 100
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TupleTests.cs
  80. 519
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TupleTests.opt.roslyn.il
  81. 540
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TupleTests.roslyn.il
  82. 5
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.cs
  83. 28
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.il
  84. 22
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.opt.il
  85. 13
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.opt.roslyn.il
  86. 19
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.roslyn.il
  87. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.il
  88. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.opt.il
  89. 51
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.opt.roslyn.il
  90. 59
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/UnsafeCode.roslyn.il
  91. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.il
  92. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.opt.il
  93. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.il
  94. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.opt.il
  95. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.il
  96. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.opt.il
  97. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.il
  98. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.opt.il
  99. 21
      ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemHelper.cs
  100. 9
      ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs
  101. Some files were not shown because too many files have changed in this diff Show More

16
ICSharpCode.Decompiler.Tests/Helpers/RemoveCompilerAttribute.cs

@ -6,9 +6,9 @@ using ICSharpCode.Decompiler.TypeSystem; @@ -6,9 +6,9 @@ using ICSharpCode.Decompiler.TypeSystem;
namespace ICSharpCode.Decompiler.Tests.Helpers
{
class RemoveCompilerAttribute : DepthFirstAstVisitor<object, object>, IAstTransform
class RemoveCompilerAttribute : DepthFirstAstVisitor, IAstTransform
{
public override object VisitAttribute(CSharp.Syntax.Attribute attribute, object data)
public override void VisitAttribute(CSharp.Syntax.Attribute attribute)
{
var section = (AttributeSection)attribute.Parent;
SimpleType type = attribute.Type as SimpleType;
@ -25,16 +25,15 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -25,16 +25,15 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
if (section.Attributes.Count == 0)
section.Remove();
}
return null;
}
public void Run(AstNode rootNode, TransformContext context)
{
rootNode.AcceptVisitor(this, null);
rootNode.AcceptVisitor(this);
}
}
public class RemoveEmbeddedAtttributes : DepthFirstAstVisitor<object, object>, IAstTransform
public class RemoveEmbeddedAtttributes : DepthFirstAstVisitor, IAstTransform
{
HashSet<string> attributeNames = new HashSet<string>() {
"System.Runtime.CompilerServices.IsReadOnlyAttribute",
@ -42,21 +41,20 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -42,21 +41,20 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
"Microsoft.CodeAnalysis.EmbeddedAttribute",
};
public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
{
var typeDefinition = typeDeclaration.GetSymbol() as ITypeDefinition;
if (typeDefinition == null || !attributeNames.Contains(typeDefinition.FullName))
return null;
return;
if (typeDeclaration.Parent is NamespaceDeclaration ns && ns.Members.Count == 1)
ns.Remove();
else
typeDeclaration.Remove();
return null;
}
public void Run(AstNode rootNode, TransformContext context)
{
rootNode.AcceptVisitor(this, null);
rootNode.AcceptVisitor(this);
}
}
}

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

@ -110,7 +110,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -110,7 +110,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
{
if (asmOptions.HasFlag(AssemblerOptions.UseOwnDisassembler)) {
using (ModuleDefinition module = ModuleDefinition.ReadModule(sourceFileName))
using (var writer = new StreamWriter(outputFile)) {
using (var writer = new StringWriter()) {
module.Name = Path.GetFileNameWithoutExtension(outputFile);
var output = new PlainTextOutput(writer);
ReflectionDisassembler rd = new ReflectionDisassembler(output, CancellationToken.None);
@ -122,6 +122,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -122,6 +122,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
rd.WriteModuleHeader(module, skipMVID: true);
output.WriteLine();
rd.WriteModuleContents(module);
File.WriteAllText(outputFile, ReplacePrivImplDetails(writer.ToString()));
}
return outputFile;
}
@ -157,11 +159,17 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -157,11 +159,17 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
il = Regex.Replace(il, @"^// +Copyright .* Microsoft.*\r?\n", "", RegexOptions.Multiline);
// filename may contain full path
il = Regex.Replace(il, @"^// WARNING: Created Win32 resource file.*\r?\n", "", RegexOptions.Multiline);
il = ReplacePrivImplDetails(il);
File.WriteAllText(outputFile, il);
return outputFile;
}
private static string ReplacePrivImplDetails(string il)
{
return Regex.Replace(il, @"'<PrivateImplementationDetails>\{[0-9A-F-]+\}'", "'<PrivateImplementationDetails>'");
}
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");
@ -170,7 +178,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -170,7 +178,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "mscorlib.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Core.dll")),
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Xml.dll"))
MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Xml.dll")),
MetadataReference.CreateFromFile(typeof(ValueTuple).Assembly.Location)
};
});

9
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -37,8 +37,8 @@ @@ -37,8 +37,8 @@
<ItemGroup>
<PackageReference Include="DiffLib" Version="1.0.0.55" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="2.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="2.8.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.3.1" />
<PackageReference Include="NUnit" Version="3.9.0" />
@ -62,13 +62,17 @@ @@ -62,13 +62,17 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Semantics\ConversionTests.cs" />
<Compile Include="Semantics\ExplicitConversionTest.cs" />
<Compile Include="Semantics\OverloadResolutionTests.cs" />
<Compile Include="DataFlowTest.cs" />
<Compile Include="TestCases\Correctness\RefLocalsAndReturns.cs" />
<Compile Include="TestCases\Pretty\Issue1080.cs" />
<Compile Include="TestCases\Pretty\QualifierTests.cs" />
<Compile Include="TestCases\Pretty\RefLocalsAndReturns.cs" />
<Compile Include="TestCases\Pretty\TupleTests.cs" />
<Compile Include="TestCases\Pretty\WellKnownConstants.cs" />
<Compile Include="TypeSystem\TypeSystemHelper.cs" />
<Compile Include="TypeSystem\TypeSystemLoaderTests.cs" />
<Compile Include="TypeSystem\TypeSystemTestCase.cs" />
<Compile Include="VBPrettyTestRunner.cs" />
@ -81,6 +85,7 @@ @@ -81,6 +85,7 @@
<Compile Include="TestCases\ILPretty\Issue1038.cs" />
<None Include="TestCases\ILPretty\Issue1038.il" />
<Compile Include="TestCases\Ugly\NoArrayInitializers.cs" />
<None Include="TestCases\ILPretty\Issue1145.il" />
<None Include="TestCases\Ugly\NoArrayInitializers.Expected.cs" />
<None Include="TestCases\ILPretty\Issue1047.cs" />
<Compile Include="TestCases\Correctness\NullPropagation.cs" />

18
ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs

@ -94,6 +94,24 @@ namespace ICSharpCode.Decompiler.Tests @@ -94,6 +94,24 @@ namespace ICSharpCode.Decompiler.Tests
Run(settings: new DecompilerSettings { RemoveDeadCode = true });
}
[Test]
public void CS1xSwitch_Debug()
{
Run();
}
[Test]
public void CS1xSwitch_Release()
{
Run();
}
[Test]
public void Issue1145()
{
Run();
}
[Test, Ignore("?")]
public void FSharpLoops_Debug()
{

6
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -279,6 +279,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -279,6 +279,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void TupleTests([ValueSource("roslynOnlyOptions")] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test]
public void Issue1080([ValueSource(nameof(roslynOnlyOptions))] CSharpCompilerOptions cscOptions)
{

1507
ICSharpCode.Decompiler.Tests/Semantics/ConversionTests.cs

File diff suppressed because it is too large Load Diff

940
ICSharpCode.Decompiler.Tests/Semantics/ExplicitConversionTest.cs

@ -0,0 +1,940 @@ @@ -0,0 +1,940 @@
// Copyright (c) 2010-2013 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 ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.Tests.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using NUnit.Framework;
namespace ICSharpCode.Decompiler.Tests.Semantics
{
using dynamic = ICSharpCode.Decompiler.TypeSystem.ReflectionHelper.Dynamic;
using C = Conversion;
[TestFixture, Parallelizable(ParallelScope.All)]
public class ExplicitConversionsTest
{
CSharpConversions conversions;
ICompilation compilation;
[OneTimeSetUp]
public void SetUp()
{
compilation = new SimpleCompilation(TypeSystemLoaderTests.TestAssembly,
TypeSystemLoaderTests.Mscorlib,
TypeSystemLoaderTests.SystemCore);
conversions = new CSharpConversions(compilation);
}
Conversion ExplicitConversion(Type from, Type to)
{
IType from2 = compilation.FindType(from);
IType to2 = compilation.FindType(to);
return conversions.ExplicitConversion(from2, to2);
}
[Test]
public void PointerConversion()
{
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(int*), typeof(short)));
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(short), typeof(void*)));
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(void*), typeof(int*)));
Assert.AreEqual(C.ExplicitPointerConversion, ExplicitConversion(typeof(long*), typeof(byte*)));
}
[Test]
public void ConversionFromDynamic()
{
// Explicit dynamic conversion is for resolve results only;
// otherwise it's an explicit reference / unboxing conversion
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic), typeof(string)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(dynamic), typeof(int)));
var dynamicRR = new ResolveResult(SpecialType.Dynamic);
Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(string))));
Assert.AreEqual(C.ExplicitDynamicConversion, conversions.ExplicitConversion(dynamicRR, compilation.FindType(typeof(int))));
}
[Test]
public void NumericConversions()
{
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(sbyte), typeof(uint)));
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(sbyte), typeof(char)));
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(char)));
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(sbyte)));
// if an implicit conversion exists, ExplicitConversion() should return that
Assert.AreEqual(C.ImplicitNumericConversion, ExplicitConversion(typeof(byte), typeof(int)));
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(double), typeof(float)));
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(double), typeof(decimal)));
Assert.AreEqual(C.ExplicitNumericConversion, ExplicitConversion(typeof(decimal), typeof(double)));
Assert.AreEqual(C.ImplicitNumericConversion, ExplicitConversion(typeof(int), typeof(decimal)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(bool), typeof(int)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(int), typeof(bool)));
}
[Test]
public void EnumerationConversions()
{
var explicitEnumerationConversion = C.EnumerationConversion(false, false);
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(sbyte), typeof(StringComparison)));
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(char), typeof(StringComparison)));
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(int), typeof(StringComparison)));
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(decimal), typeof(StringComparison)));
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(char)));
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(int)));
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(decimal)));
Assert.AreEqual(explicitEnumerationConversion, ExplicitConversion(typeof(StringComparison), typeof(StringSplitOptions)));
}
[Test]
public void NullableConversion_BasedOnIdentityConversion()
{
Assert.AreEqual(C.IdentityConversion, ExplicitConversion(typeof(ArraySegment<dynamic>?), typeof(ArraySegment<object>?)));
Assert.AreEqual(C.ImplicitNullableConversion, ExplicitConversion(typeof(ArraySegment<dynamic>), typeof(ArraySegment<object>?)));
Assert.AreEqual(C.ExplicitNullableConversion, ExplicitConversion(typeof(ArraySegment<dynamic>?), typeof(ArraySegment<object>)));
}
[Test]
public void NullableConversion_BasedOnImplicitNumericConversion()
{
Assert.AreEqual(C.ImplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(long?)));
Assert.AreEqual(C.ImplicitLiftedNumericConversion, ExplicitConversion(typeof(int), typeof(long?)));
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(long)));
}
[Test]
public void NullableConversion_BasedOnImplicitEnumerationConversion()
{
ResolveResult zero = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 0);
ResolveResult one = new ConstantResolveResult(compilation.FindType(KnownTypeCode.Int32), 1);
Assert.AreEqual(C.EnumerationConversion(true, true), conversions.ExplicitConversion(zero, compilation.FindType(typeof(StringComparison?))));
Assert.AreEqual(C.EnumerationConversion(false, true), conversions.ExplicitConversion(one, compilation.FindType(typeof(StringComparison?))));
}
[Test]
public void NullableConversion_BasedOnExplicitNumericConversion()
{
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(short?)));
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int), typeof(short?)));
Assert.AreEqual(C.ExplicitLiftedNumericConversion, ExplicitConversion(typeof(int?), typeof(short)));
}
[Test]
public void NullableConversion_BasedOnExplicitEnumerationConversion()
{
C c = C.EnumerationConversion(false, true); // c = explicit lifted enumeration conversion
Assert.AreEqual(c, ExplicitConversion(typeof(int?), typeof(StringComparison?)));
Assert.AreEqual(c, ExplicitConversion(typeof(int), typeof(StringComparison?)));
Assert.AreEqual(c, ExplicitConversion(typeof(int?), typeof(StringComparison)));
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(int?)));
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison), typeof(int?)));
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(int)));
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(StringSplitOptions?)));
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison), typeof(StringSplitOptions?)));
Assert.AreEqual(c, ExplicitConversion(typeof(StringComparison?), typeof(StringSplitOptions)));
}
[Test]
public void ExplicitReferenceConversion_SealedClass()
{
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object), typeof(string)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<char>), typeof(string)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<int>), typeof(string)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<object>), typeof(string)));
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string), typeof(IEnumerable<char>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(string), typeof(IEnumerable<int>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(string), typeof(IEnumerable<object>)));
}
[Test]
public void ExplicitReferenceConversion_NonSealedClass()
{
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object), typeof(List<string>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(List<string>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(List<string>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<int>), typeof(List<string>)));
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(List<string>), typeof(IEnumerable<object>)));
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(List<string>), typeof(IEnumerable<string>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(List<string>), typeof(IEnumerable<int>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(List<string>), typeof(List<object>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(List<string>), typeof(List<int>)));
}
[Test]
public void ExplicitReferenceConversion_Interfaces()
{
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(IEnumerable<object>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<int>), typeof(IEnumerable<object>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(IEnumerable<string>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(IEnumerable<int>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(IConvertible)));
}
[Test]
public void ExplicitReferenceConversion_Arrays()
{
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object[]), typeof(string[])));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic[]), typeof(string[])));
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(object[,])));
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(int[])));
Assert.AreEqual(C.None, ExplicitConversion(typeof(short[]), typeof(int[])));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Array), typeof(int[])));
}
[Test]
public void ExplicitReferenceConversion_InterfaceToArray()
{
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(ICloneable), typeof(int[])));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(string[])));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<object>), typeof(string[])));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(object[])));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<string>), typeof(dynamic[])));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(IEnumerable<int>), typeof(int[])));
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<string>), typeof(object[,])));
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<short>), typeof(object[])));
}
[Test]
public void ExplicitReferenceConversion_ArrayToInterface()
{
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(int[]), typeof(ICloneable)));
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string[]), typeof(IEnumerable<string>)));
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(string[]), typeof(IEnumerable<object>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(object[]), typeof(IEnumerable<string>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(dynamic[]), typeof(IEnumerable<string>)));
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(int[]), typeof(IEnumerable<int>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[,]), typeof(IEnumerable<string>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(object[]), typeof(IEnumerable<short>)));
}
[Test]
public void ExplicitReferenceConversion_Delegates()
{
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(MulticastDelegate), typeof(Action)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Delegate), typeof(Action)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(ICloneable), typeof(Action)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(System.Threading.ThreadStart), typeof(Action)));
}
[Test]
public void ExplicitReferenceConversion_GenericDelegates()
{
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(Action<object>), typeof(Action<string>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action<string>), typeof(Action<object>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Func<object>), typeof(Func<string>)));
Assert.AreEqual(C.ImplicitReferenceConversion, ExplicitConversion(typeof(Func<string>), typeof(Func<object>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action<IFormattable>), typeof(Action<IConvertible>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(Action<IFormattable>), typeof(Action<int>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Action<string>), typeof(Action<IEnumerable<int>>)));
Assert.AreEqual(C.ExplicitReferenceConversion, ExplicitConversion(typeof(Func<IFormattable>), typeof(Func<IConvertible>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(Func<IFormattable>), typeof(Func<int>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(Func<string>), typeof(Func<IEnumerable<int>>)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(Func<string>), typeof(Func<IEnumerable<int>>)));
}
[Test]
public void UnboxingConversion()
{
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(int)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(decimal)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(ValueType), typeof(int)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(IFormattable), typeof(int)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<object>), typeof(int)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(Enum), typeof(StringComparison)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(Enum), typeof(int)));
}
[Test]
public void LiftedUnboxingConversion()
{
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(int?)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(object), typeof(decimal?)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(ValueType), typeof(int?)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(IFormattable), typeof(int?)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(IEnumerable<object>), typeof(int?)));
Assert.AreEqual(C.UnboxingConversion, ExplicitConversion(typeof(Enum), typeof(StringComparison?)));
Assert.AreEqual(C.None, ExplicitConversion(typeof(Enum), typeof(int?)));
}
/* TODO: we should probably revive these tests somehow
Conversion ResolveCast(string program)
{
return Resolve<ConversionResolveResult>(program).Conversion;
}
[Test]
public void ObjectToTypeParameter()
{
string program = @"using System;
class Test {
public void M<T>(object o) {
T t = $(T)o$;
}
}";
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program));
}
[Test]
public void UnrelatedClassToTypeParameter()
{
string program = @"using System;
class Test {
public void M<T>(string o) {
T t = $(T)o$;
}
}";
Assert.AreEqual(C.None, ResolveCast(program));
}
[Test]
public void IntefaceToTypeParameter()
{
string program = @"using System;
class Test {
public void M<T>(IDisposable o) {
T t = $(T)o$;
}
}";
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program));
}
[Test]
public void TypeParameterToInterface()
{
string program = @"using System;
class Test {
public void M<T>(T t) {
IDisposable d = $(IDisposable)t$;
}
}";
Assert.AreEqual(C.BoxingConversion, ResolveCast(program));
}
[Test]
public void ValueTypeToTypeParameter()
{
string program = @"using System;
class Test {
public void M<T>(ValueType o) where T : struct {
T t = $(T)o$;
}
}";
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program));
}
[Test]
public void InvalidTypeParameterConversion()
{
string program = @"using System;
class Test {
public void M<T, U>(T t) {
U u = $(U)t$;
}
}";
Assert.AreEqual(C.None, ResolveCast(program));
}
[Test]
public void TypeParameterConversion1()
{
string program = @"using System;
class Test {
public void M<T, U>(T t) where T : U {
U u = $(U)t$;
}
}";
Assert.AreEqual(C.BoxingConversion, ResolveCast(program));
}
[Test]
public void TypeParameterConversion1Array()
{
string program = @"using System;
class Test {
public void M<T, U>(T[] t) where T : U {
U[] u = $(U[])t$;
}
}";
Assert.AreEqual(C.None, ResolveCast(program));
}
[Test]
public void TypeParameterConversion2()
{
string program = @"using System;
class Test {
public void M<T, U>(T t) where U : T {
U u = $(U)t$;
}
}";
Assert.AreEqual(C.UnboxingConversion, ResolveCast(program));
}
[Test]
public void TypeParameterConversion2Array()
{
string program = @"using System;
class Test {
public void M<T, U>(T[] t) where U : T {
U[] u = $(U[])t$;
}
}";
Assert.AreEqual(C.None, ResolveCast(program));
}
[Test]
public void ImplicitTypeParameterConversionWithClassConstraint()
{
string program = @"using System;
class Test {
public void M<T, U>(T t) where T : class where U : class, T {
U u = $(U)t$;
}
}";
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program));
}
[Test]
public void ImplicitTypeParameterArrayConversionWithClassConstraint()
{
string program = @"using System;
class Test {
public void M<T, U>(T[] t) where T : class where U : class, T {
U[] u = $(U[])t$;
}
}";
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program));
}
[Test]
public void ImplicitTypeParameterConversionWithClassConstraintOnlyOnT()
{
string program = @"using System;
class Test {
public void M<T, U>(T t) where U : class, T {
U u = $(U)t$;
}
}";
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program));
}
[Test]
public void ImplicitTypeParameterArrayConversionWithClassConstraintOnlyOnT()
{
string program = @"using System;
class Test {
public void M<T, U>(T[] t) where U : class, T {
U[] u = $(U[])t$;
}
}";
Assert.AreEqual(C.ExplicitReferenceConversion, ResolveCast(program));
}
[Test]
public void SimpleUserDefinedConversion()
{
var rr = Resolve<ConversionResolveResult>(@"
class C1 {}
class C2 {
public static explicit operator C1(C2 c2) {
return null;
}
}
class C {
public void M() {
var c2 = new C2();
C1 c1 = $(C1)c2$;
}
}");
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("op_Explicit", rr.Conversion.Method.Name);
}
[Test]
public void ExplicitReferenceConversionFollowedByUserDefinedConversion()
{
var rr = Resolve<ConversionResolveResult>(@"
class B {}
class S : B {}
class T {
public static explicit operator T(S s) { return null; }
}
class Test {
void Run(B b) {
T t = $(T)b$;
}
}");
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("B", rr.Input.Type.Name);
}
[Test]
public void ImplicitUserDefinedConversionFollowedByExplicitNumericConversion()
{
var rr = Resolve<ConversionResolveResult>(@"
struct T {
public static implicit operator float(T t) { return 0; }
}
class Test {
void Run(T t) {
int x = $(int)t$;
}
}");
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
// even though the user-defined conversion is implicit, the combined conversion is explicit
Assert.IsTrue(rr.Conversion.IsExplicit);
}
[Test]
public void BothDirectConversionAndBaseClassConversionAvailable()
{
var rr = Resolve<ConversionResolveResult>(@"
class B {}
class S : B {}
class T {
public static explicit operator T(S s) { return null; }
public static explicit operator T(B b) { return null; }
}
class Test {
void Run(B b) {
T t = $(T)b$;
}
}");
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("b", rr.Conversion.Method.Parameters.Single().Name);
}
[Test]
public void UserDefinedExplicitConversion_PicksExactSourceTypeIfPossible()
{
string program = @"using System;
class Convertible {
public static explicit operator Convertible(int i) {return new Convertible(); }
public static explicit operator Convertible(short s) {return new Convertible(); }
}
class Test {
public void M() {
var a = $(Convertible)33$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_PicksMostEncompassedSourceTypeIfPossible()
{
string program = @"using System;
class Convertible {
public static explicit operator Convertible(long l) {return new Convertible(); }
public static explicit operator Convertible(uint ui) {return new Convertible(); }
}
class Test {
public void M() {
var a = $(Convertible)(ushort)33$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_PicksMostEncompassingSourceType()
{
string program = @"using System;
class Convertible {
public static explicit operator Convertible(int i) {return new Convertible(); }
public static explicit operator Convertible(ushort us) {return new Convertible(); }
}
class Test {
public void M() {
var a = $(Convertible)(long)33$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_NoMostEncompassingSourceTypeIsInvalid()
{
string program = @"using System;
class Convertible {
public static explicit operator Convertible(uint i) {return new Convertible(); }
public static explicit operator Convertible(short us) {return new Convertible(); }
}
class Test {
public void M() {
var a = $(Convertible)(long)33$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsFalse(rr.Conversion.IsValid);
}
[Test]
public void UserDefinedExplicitConversion_PicksExactTargetTypeIfPossible()
{
string program = @"using System;
class Convertible {
public static explicit operator int(Convertible i) {return 0; }
public static explicit operator short(Convertible s) {return 0; }
}
class Test {
public void M() {
var a = $(int)new Convertible()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_PicksMostEncompassingTargetTypeIfPossible()
{
string program = @"using System;
class Convertible {
public static explicit operator int(Convertible i) {return 0; }
public static explicit operator ushort(Convertible us) {return 0; }
}
class Test {
public void M() {
var a = $(ulong)new Convertible()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("us", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_PicksMostEncompassedTargetType()
{
string program = @"using System;
class Convertible {
public static explicit operator long(Convertible l) { return 0; }
public static explicit operator uint(Convertible ui) { return 0; }
}
class Test {
public void M() {
var a = $(ushort)new Convertible()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_NoMostEncompassedTargetTypeIsInvalid()
{
string program = @"using System;
class Convertible {
public static explicit operator ulong(Convertible l) { return 0; }
public static explicit operator int(Convertible ui) { return 0; }
}
class Test {
public void M() {
var a = $(ushort)new Convertible()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsFalse(rr.Conversion.IsValid);
}
[Test]
public void UserDefinedExplicitConversion_AmbiguousIsInvalid()
{
string program = @"using System;
class Convertible1 {
public static explicit operator Convertible2(Convertible1 c) {return 0; }
}
class Convertible2 {
public static explicit operator Convertible2(Convertible1 c) {return 0; }
}
class Test {
public void M() {
var a = $(Convertible2)new Convertible1()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsFalse(rr.Conversion.IsValid);
}
[Test]
public void UserDefinedExplicitConversion_Lifted()
{
string program = @"using System;
struct Convertible {
public static explicit operator Convertible(int i) {return new Convertible(); }
}
class Test {
public void M(int? i) {
a = $(Convertible?)i$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.IsTrue(rr.Conversion.IsLifted);
}
[Test]
public void UserDefinedExplicitConversionFollowedByImplicitNullableConversion()
{
string program = @"using System;
struct Convertible {
public static explicit operator Convertible(int i) {return new Convertible(); }
}
class Test {
public void M(int i) {
a = $(Convertible?)i$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.IsFalse(rr.Conversion.IsLifted);
}
[Test]
public void UserDefinedExplicitConversion_ExplicitNullable_ThenUserDefined()
{
string program = @"using System;
struct Convertible {
public static explicit operator Convertible(int i) {return new Convertible(); }
public static explicit operator Convertible?(int? ni) {return new Convertible(); }
}
class Test {
public void M(int? i) {
a = $(Convertible)i$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.IsFalse(rr.Conversion.IsLifted);
Assert.AreEqual("i", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_DefinedNullableTakesPrecedenceOverLifted()
{
string program = @"using System;
struct Convertible {
public static explicit operator Convertible(int i) {return new Convertible(); }
public static explicit operator Convertible?(int? ni) {return new Convertible(); }
}
class Test {
public void M() {
a = $(Convertible?)(int?)33$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.IsFalse(rr.Conversion.IsLifted);
Assert.AreEqual("ni", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_UIntConstant()
{
string program = @"using System;
class Convertible {
public static explicit operator Convertible(long l) {return new Convertible(); }
public static explicit operator Convertible(uint ui) {return new Convertible(); }
}
class Test {
public void M() {
var a = $(Convertible)33$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_NullableUIntConstant()
{
string program = @"using System;
class Convertible {
public static explicit operator Convertible(long? l) {return new Convertible(); }
public static explicit operator Convertible(uint? ui) {return new Convertible(); }
}
class Test {
public void M() {
Convertible a = $(Convertible)33$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("ui", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UseDefinedExplicitConversion_Lifted()
{
string program = @"
struct Convertible {
public static explicit operator Convertible(int i) { return new Convertible(); }
}
class Test {
public void M(int? i) {
a = $(Convertible?)i$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.IsTrue(rr.Conversion.IsLifted);
Assert.IsTrue(rr.Input is LocalResolveResult);
}
[Test]
public void UserDefinedExplicitConversion_Short_Or_NullableByte_Target()
{
string program = @"using System;
class Test {
public static explicit operator short(Test s) { return 0; }
public static explicit operator byte?(Test b) { return 0; }
}
class Program {
public static void Main(string[] args)
{
int? x = $(int?)new Test()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("System.Int16", rr.Conversion.Method.ReturnType.FullName);
}
[Test]
public void UserDefinedExplicitConversion_Byte_Or_NullableShort_Target()
{
string program = @"using System;
class Test {
public static explicit operator byte(Test b) { return 0; }
public static explicit operator short?(Test s) { return 0; }
}
class Program {
public static void Main(string[] args)
{
int? x = $(int?)new Test()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("s", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void ExplicitConversionOperatorsCanOverrideApplicableImplicitOnes()
{
string program = @"
struct Convertible {
public static explicit operator int(Convertible ci) {return 0; }
public static implicit operator short(Convertible cs) {return 0; }
}
class Test {
static void Main() {
int i = $(int)new Convertible()$; // csc uses the explicit conversion operator
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.IsUserDefined);
Assert.AreEqual("ci", rr.Conversion.Method.Parameters[0].Name);
}
[Test]
public void UserDefinedExplicitConversion_ConversionBeforeUserDefinedOperatorIsCorrect()
{
string program = @"using System;
class Convertible {
public static implicit operator Convertible(int l) {return new Convertible(); }
}
class Test {
public void M() {
long i = 33;
Convertible a = $(Convertible)i$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsValid);
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsExplicit);
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsNumericConversion);
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsIdentityConversion);
}
[Test]
public void UserDefinedExplicitConversion_ConversionAfterUserDefinedOperatorIsCorrect()
{
string program = @"using System;
class Convertible {
public static implicit operator long(Convertible i) {return 0; }
}
class Test {
public void M() {
int a = $(int)new Convertible()$;
}
}";
var rr = Resolve<ConversionResolveResult>(program);
Assert.IsTrue(rr.Conversion.IsValid);
Assert.IsTrue(rr.Conversion.ConversionBeforeUserDefinedOperator.IsIdentityConversion);
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsValid);
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsExplicit);
Assert.IsTrue(rr.Conversion.ConversionAfterUserDefinedOperator.IsNumericConversion);
}*/
}
}

32
ICSharpCode.Decompiler.Tests/Semantics/OverloadResolutionTests.cs

@ -1,11 +1,28 @@ @@ -1,11 +1,28 @@
using System;
// Copyright (c) 2010-2013 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.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.Tests.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using NUnit.Framework;
@ -17,13 +34,12 @@ namespace ICSharpCode.Decompiler.Tests.Semantics @@ -17,13 +34,12 @@ namespace ICSharpCode.Decompiler.Tests.Semantics
{
ICompilation compilation;
[SetUp]
[OneTimeSetUp]
public void SetUp()
{
var cecilLoader = new CecilLoader() { IncludeInternalMembers = true };
var mscorlib = cecilLoader.LoadAssemblyFile(typeof(object).Assembly.Location);
var systemCore = cecilLoader.LoadAssemblyFile(typeof(System.Linq.Enumerable).Assembly.Location);
compilation = new SimpleCompilation(cecilLoader.LoadAssemblyFile(typeof(OverloadResolutionTests).Assembly.Location), mscorlib, systemCore);
compilation = new SimpleCompilation(TypeSystemLoaderTests.TestAssembly,
TypeSystemLoaderTests.Mscorlib,
TypeSystemLoaderTests.SystemCore);
}
ResolveResult[] MakeArgumentList(params Type[] argumentTypes)

64
ICSharpCode.Decompiler.Tests/TestCases/Correctness/CompoundAssignment.cs

@ -31,6 +31,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -31,6 +31,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
UnsignedShiftRightInstanceField();
UnsignedShiftRightStaticProperty();
DivideByBigValue();
Overflow();
}
static void Test(int a, int b)
@ -77,9 +78,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -77,9 +78,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
}
static ushort shortField;
static short shortField;
public static ushort ShortProperty {
public static short ShortProperty {
get {
Console.WriteLine("In get_ShortProperty");
return shortField;
@ -90,6 +91,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -90,6 +91,19 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
}
static byte byteField;
public static byte ByteProperty {
get {
Console.WriteLine("In get_ByteProperty");
return byteField;
}
set {
Console.WriteLine("In set_ByteProperty, value={0}", value);
byteField = value;
}
}
public static Dictionary<string, int> GetDict()
{
Console.WriteLine("In GetDict()");
@ -144,15 +158,55 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -144,15 +158,55 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
static void UnsignedShiftRightStaticProperty()
{
Console.WriteLine("UnsignedShiftRightStaticProperty:");
StaticProperty = -15;
Test(X(), StaticProperty = (int)((uint)StaticProperty >> 2));
ShortProperty = -20;
ShortProperty = (short)((uint)StaticProperty >> 2);
ShortProperty = -30;
ShortProperty = (short)((ushort)StaticProperty >> 2);
}
static void DivideByBigValue()
{
ShortProperty = 5;
// can't use "ShortProperty /= (ushort)(ushort.MaxValue + 3)" because that would be division by 2.
ShortProperty = (ushort)(ShortProperty / (ushort.MaxValue + 3));
Console.WriteLine("DivideByBigValue:");
ByteProperty = 5;
// can't use "ByteProperty /= (byte)(byte.MaxValue + 3)" because that would be division by 2.
ByteProperty = (byte)(ByteProperty / (byte.MaxValue + 3));
ByteProperty = 200;
ByteProperty = (byte)(ByteProperty / Id(byte.MaxValue + 3));
ShortProperty = short.MaxValue;
ShortProperty = (short)(ShortProperty / (short.MaxValue + 3));
}
static void Overflow()
{
Console.WriteLine("Overflow:");
ByteProperty = 0;
ByteProperty = (byte)checked(ByteProperty + 300);
try {
ByteProperty = checked((byte)(ByteProperty + 300));
} catch (OverflowException) {
Console.WriteLine("Overflow OK");
}
ByteProperty = 200;
ByteProperty = (byte)checked(ByteProperty + 100);
ByteProperty = 201;
try {
ByteProperty = checked((byte)(ByteProperty + 100));
} catch (OverflowException) {
Console.WriteLine("Overflow OK");
}
}
static T Id<T>(T val)
{
return val;
}
}
}

22
ICSharpCode.Decompiler.Tests/TestCases/Correctness/MemberLookup.cs

@ -29,6 +29,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -29,6 +29,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
Console.WriteLine((new Child1() as Base1).Field);
Child1.Test();
delegateConstruction();
new Child2b().CallTestMethod();
return 0;
}
@ -82,6 +83,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -82,6 +83,8 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
child.TestMethod();
Console.WriteLine("Child1.TestMethod()");
Console.WriteLine("Property = " + Property + " " + base.Property);
Console.WriteLine("Field = " + Field);
Console.WriteLine("base.Field = " + base.Field);
}
new public void TestAction()
@ -97,5 +100,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -97,5 +100,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
}
}
class Child2 : Base1
{
public void CallTestMethod()
{
Console.WriteLine("Child2 calling this.TestMethod():");
this.TestMethod();
Console.WriteLine("Child2 calling base.TestMethod():");
base.TestMethod();
}
}
class Child2b : Child2
{
protected override void TestMethod()
{
Console.WriteLine("Child2b.TestMethod");
}
}
}
}

412
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Debug.cs

@ -0,0 +1,412 @@ @@ -0,0 +1,412 @@
// 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;
using System.Reflection;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class Switch
{
public class SetProperty
{
public readonly PropertyInfo Property;
private int _set;
public int Set {
get {
return _set;
}
set {
_set = value;
}
}
public SetProperty(PropertyInfo property)
{
Property = property;
}
}
public enum State
{
False,
True,
Null
}
public static string SparseIntegerSwitch(int i)
{
Console.WriteLine("SparseIntegerSwitch: " + i);
switch (i) {
case -10000000:
return "-10 mln";
case -100:
return "-hundred";
case -1:
return "-1";
case 0:
return "0";
case 1:
return "1";
case 2:
return "2";
case 4:
return "4";
case 100:
return "hundred";
case 10000:
return "ten thousand";
case 10001:
return "ten thousand and one";
case int.MaxValue:
return "int.MaxValue";
default:
return "something else";
}
}
public static void SwitchOverInt(int i)
{
switch (i) {
case 0:
Console.WriteLine("zero");
break;
case 5:
Console.WriteLine("five");
break;
case 10:
Console.WriteLine("ten");
break;
case 15:
Console.WriteLine("fifteen");
break;
case 20:
Console.WriteLine("twenty");
break;
case 25:
Console.WriteLine("twenty-five");
break;
case 30:
Console.WriteLine("thirty");
break;
}
}
public static string ShortSwitchOverString(string text)
{
Console.WriteLine("ShortSwitchOverString: " + text);
switch (text) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case "Third case":
return "Text3";
default:
return "Default";
}
}
public static string ShortSwitchOverStringWithNullCase(string text)
{
Console.WriteLine("ShortSwitchOverStringWithNullCase: " + text);
switch (text) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case null:
return "null";
default:
return "Default";
}
}
public static string SwitchOverString1(string text)
{
Console.WriteLine("SwitchOverString1: " + text);
switch (text) {
case "First case":
return "Text1";
case "Second case":
case "2nd case":
return "Text2";
case "Third case":
return "Text3";
case "Fourth case":
return "Text4";
case "Fifth case":
return "Text5";
case "Sixth case":
return "Text6";
case null:
return null;
default:
return "Default";
}
}
public static string SwitchOverString2()
{
Console.WriteLine("SwitchOverString2:");
switch (Environment.UserName) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case "Third case":
return "Text3";
case "Fourth case":
return "Text4";
case "Fifth case":
return "Text5";
case "Sixth case":
return "Text6";
case "Seventh case":
return "Text7";
case "Eighth case":
return "Text8";
case "Ninth case":
return "Text9";
case "Tenth case":
return "Text10";
case "Eleventh case":
return "Text11";
default:
return "Default";
}
}
public static string TwoDifferentSwitchBlocksInTryFinally()
{
try {
Console.WriteLine("TwoDifferentSwitchBlocks:");
switch (Environment.UserName) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case "Third case":
return "Text3";
case "Fourth case":
return "Text4";
case "Fifth case":
return "Text5";
case "Sixth case":
return "Text6";
case "Seventh case":
return "Text7";
case "Eighth case":
return "Text8";
case "Ninth case":
return "Text9";
case "Tenth case":
return "Text10";
case "Eleventh case":
return "Text11";
default:
return "Default";
}
} finally {
Console.WriteLine("Second switch:");
switch (Console.ReadLine()) {
case "12":
Console.WriteLine("Te43234xt1");
break;
case "13":
Console.WriteLine("Te223443xt2");
break;
case "14":
Console.WriteLine("Te234xt3");
break;
case "15":
Console.WriteLine("Tex243t4");
break;
case "16":
Console.WriteLine("Tex243t5");
break;
case "17":
Console.WriteLine("Text2346");
break;
case "18":
Console.WriteLine("Text234234");
break;
case "19 case":
Console.WriteLine("Text8234");
break;
case "20 case":
Console.WriteLine("Text923423");
break;
case "21 case":
Console.WriteLine("Text10");
break;
case "22 case":
Console.WriteLine("Text1134123");
break;
default:
Console.WriteLine("Defa234234ult");
break;
}
}
}
public static string SwitchOverBool(bool b)
{
Console.WriteLine("SwitchOverBool: " + b.ToString());
switch (b) {
case true:
return bool.TrueString;
case false:
return bool.FalseString;
default:
return null;
}
}
public static void SwitchInLoop(int i)
{
Console.WriteLine("SwitchInLoop: " + i);
while (true) {
switch (i) {
case 1:
Console.WriteLine("one");
break;
case 2:
Console.WriteLine("two");
break;
//case 3:
// Console.WriteLine("three");
// continue;
case 4:
Console.WriteLine("four");
return;
default:
Console.WriteLine("default");
Console.WriteLine("more code");
return;
}
i++;
}
}
public static void SwitchWithGoto(int i)
{
Console.WriteLine("SwitchWithGoto: " + i);
switch (i) {
case 1:
Console.WriteLine("one");
goto default;
case 2:
Console.WriteLine("two");
goto case 3;
case 3:
Console.WriteLine("three");
break;
case 4:
Console.WriteLine("four");
return;
default:
Console.WriteLine("default");
break;
}
Console.WriteLine("End of method");
}
private static SetProperty[] GetProperties()
{
return new SetProperty[0];
}
public static void SwitchOnStringInForLoop()
{
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
SetProperty[] properties = GetProperties();
for (int i = 0; i < properties.Length; i++) {
Console.WriteLine("In for-loop");
SetProperty setProperty = properties[i];
switch (setProperty.Property.Name) {
case "Name1":
setProperty.Set = 1;
arrayList.Add(setProperty);
break;
case "Name2":
setProperty.Set = 2;
arrayList.Add(setProperty);
break;
case "Name3":
setProperty.Set = 3;
arrayList.Add(setProperty);
break;
case "Name4":
setProperty.Set = 4;
arrayList.Add(setProperty);
break;
case "Name5":
case "Name6":
arrayList.Add(setProperty);
break;
default:
arrayList2.Add(setProperty);
break;
}
}
}
public static void SwitchWithComplexCondition(string[] args)
{
switch ((args.Length == 0) ? "dummy" : args[0]) {
case "a":
Console.WriteLine("a");
break;
case "b":
Console.WriteLine("b");
break;
case "c":
Console.WriteLine("c");
break;
case "d":
Console.WriteLine("d");
break;
}
Console.WriteLine("end");
}
public static void SwitchWithArray(string[] args)
{
switch (args[0]) {
case "a":
Console.WriteLine("a");
break;
case "b":
Console.WriteLine("b");
break;
case "c":
Console.WriteLine("c");
break;
case "d":
Console.WriteLine("d");
break;
}
Console.WriteLine("end");
}
}
}

1425
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Debug.il

File diff suppressed because it is too large Load Diff

412
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Release.cs

@ -0,0 +1,412 @@ @@ -0,0 +1,412 @@
// 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;
using System.Reflection;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class Switch
{
public class SetProperty
{
public readonly PropertyInfo Property;
private int _set;
public int Set {
get {
return _set;
}
set {
_set = value;
}
}
public SetProperty(PropertyInfo property)
{
Property = property;
}
}
public enum State
{
False,
True,
Null
}
public static string SparseIntegerSwitch(int i)
{
Console.WriteLine("SparseIntegerSwitch: " + i);
switch (i) {
case -10000000:
return "-10 mln";
case -100:
return "-hundred";
case -1:
return "-1";
case 0:
return "0";
case 1:
return "1";
case 2:
return "2";
case 4:
return "4";
case 100:
return "hundred";
case 10000:
return "ten thousand";
case 10001:
return "ten thousand and one";
case int.MaxValue:
return "int.MaxValue";
default:
return "something else";
}
}
public static void SwitchOverInt(int i)
{
switch (i) {
case 0:
Console.WriteLine("zero");
break;
case 5:
Console.WriteLine("five");
break;
case 10:
Console.WriteLine("ten");
break;
case 15:
Console.WriteLine("fifteen");
break;
case 20:
Console.WriteLine("twenty");
break;
case 25:
Console.WriteLine("twenty-five");
break;
case 30:
Console.WriteLine("thirty");
break;
}
}
public static string ShortSwitchOverString(string text)
{
Console.WriteLine("ShortSwitchOverString: " + text);
switch (text) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case "Third case":
return "Text3";
default:
return "Default";
}
}
public static string ShortSwitchOverStringWithNullCase(string text)
{
Console.WriteLine("ShortSwitchOverStringWithNullCase: " + text);
switch (text) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case null:
return "null";
default:
return "Default";
}
}
public static string SwitchOverString1(string text)
{
Console.WriteLine("SwitchOverString1: " + text);
switch (text) {
case "First case":
return "Text1";
case "Second case":
case "2nd case":
return "Text2";
case "Third case":
return "Text3";
case "Fourth case":
return "Text4";
case "Fifth case":
return "Text5";
case "Sixth case":
return "Text6";
case null:
return null;
default:
return "Default";
}
}
public static string SwitchOverString2()
{
Console.WriteLine("SwitchOverString2:");
switch (Environment.UserName) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case "Third case":
return "Text3";
case "Fourth case":
return "Text4";
case "Fifth case":
return "Text5";
case "Sixth case":
return "Text6";
case "Seventh case":
return "Text7";
case "Eighth case":
return "Text8";
case "Ninth case":
return "Text9";
case "Tenth case":
return "Text10";
case "Eleventh case":
return "Text11";
default:
return "Default";
}
}
public static string TwoDifferentSwitchBlocksInTryFinally()
{
try {
Console.WriteLine("TwoDifferentSwitchBlocks:");
switch (Environment.UserName) {
case "First case":
return "Text1";
case "Second case":
return "Text2";
case "Third case":
return "Text3";
case "Fourth case":
return "Text4";
case "Fifth case":
return "Text5";
case "Sixth case":
return "Text6";
case "Seventh case":
return "Text7";
case "Eighth case":
return "Text8";
case "Ninth case":
return "Text9";
case "Tenth case":
return "Text10";
case "Eleventh case":
return "Text11";
default:
return "Default";
}
} finally {
Console.WriteLine("Second switch:");
switch (Console.ReadLine()) {
case "12":
Console.WriteLine("Te43234xt1");
break;
case "13":
Console.WriteLine("Te223443xt2");
break;
case "14":
Console.WriteLine("Te234xt3");
break;
case "15":
Console.WriteLine("Tex243t4");
break;
case "16":
Console.WriteLine("Tex243t5");
break;
case "17":
Console.WriteLine("Text2346");
break;
case "18":
Console.WriteLine("Text234234");
break;
case "19 case":
Console.WriteLine("Text8234");
break;
case "20 case":
Console.WriteLine("Text923423");
break;
case "21 case":
Console.WriteLine("Text10");
break;
case "22 case":
Console.WriteLine("Text1134123");
break;
default:
Console.WriteLine("Defa234234ult");
break;
}
}
}
public static string SwitchOverBool(bool b)
{
Console.WriteLine("SwitchOverBool: " + b.ToString());
switch (b) {
case true:
return bool.TrueString;
case false:
return bool.FalseString;
default:
return null;
}
}
public static void SwitchInLoop(int i)
{
Console.WriteLine("SwitchInLoop: " + i);
while (true) {
switch (i) {
case 1:
Console.WriteLine("one");
break;
case 2:
Console.WriteLine("two");
break;
//case 3:
// Console.WriteLine("three");
// continue;
case 4:
Console.WriteLine("four");
return;
default:
Console.WriteLine("default");
Console.WriteLine("more code");
return;
}
i++;
}
}
public static void SwitchWithGoto(int i)
{
Console.WriteLine("SwitchWithGoto: " + i);
switch (i) {
case 1:
Console.WriteLine("one");
goto default;
case 2:
Console.WriteLine("two");
goto case 3;
case 3:
Console.WriteLine("three");
break;
case 4:
Console.WriteLine("four");
return;
default:
Console.WriteLine("default");
break;
}
Console.WriteLine("End of method");
}
private static SetProperty[] GetProperties()
{
return new SetProperty[0];
}
public static void SwitchOnStringInForLoop()
{
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
SetProperty[] properties = GetProperties();
for (int i = 0; i < properties.Length; i++) {
Console.WriteLine("In for-loop");
SetProperty setProperty = properties[i];
switch (setProperty.Property.Name) {
case "Name1":
setProperty.Set = 1;
arrayList.Add(setProperty);
break;
case "Name2":
setProperty.Set = 2;
arrayList.Add(setProperty);
break;
case "Name3":
setProperty.Set = 3;
arrayList.Add(setProperty);
break;
case "Name4":
setProperty.Set = 4;
arrayList.Add(setProperty);
break;
case "Name5":
case "Name6":
arrayList.Add(setProperty);
break;
default:
arrayList2.Add(setProperty);
break;
}
}
}
public static void SwitchWithComplexCondition(string[] args)
{
switch ((args.Length == 0) ? "dummy" : args[0]) {
case "a":
Console.WriteLine("a");
break;
case "b":
Console.WriteLine("b");
break;
case "c":
Console.WriteLine("c");
break;
case "d":
Console.WriteLine("d");
break;
}
Console.WriteLine("end");
}
public static void SwitchWithArray(string[] args)
{
switch (args[0]) {
case "a":
Console.WriteLine("a");
break;
case "b":
Console.WriteLine("b");
break;
case "c":
Console.WriteLine("c");
break;
case "d":
Console.WriteLine("d");
break;
}
Console.WriteLine("end");
}
}
}

1325
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/CS1xSwitch_Release.il

File diff suppressed because it is too large Load Diff

12
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1145.cs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
using System;
public sealed class EvType : MulticastDelegate
{
}
[Serializable]
public class OwningClass
{
public event EvType EvName;
}

83
ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1145.il

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
.class public auto ansi sealed EvType extends [mscorlib]System.MulticastDelegate
{
// Methods not included. Just the run of the mill ctor + {Begin|End}?Invoke
}
.class public auto ansi serializable beforefieldinit OwningClass
{
.field class EvType EvName
.event EvType EvName
{
.addon instance void OwningClass::add_EvName(class EvType)
.removeon instance void OwningClass::remove_EvName(class EvType)
}
.method public hidebysig specialname
instance void add_EvName (
class EvType 'value'
) cil managed
{
.maxstack 3
.locals init (
[0] class EvType,
[1] class EvType
)
IL_0000: ldarg.0
IL_0001: ldfld class EvType OwningClass::EvName
IL_0006: stloc.0
// loop start (head: IL_0007)
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: ldarg.0
IL_000a: ldflda class EvType OwningClass::EvName
IL_000f: ldloc.1
IL_0010: ldarg.1
IL_0011: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Combine(class [mscorlib]System.Delegate, class [mscorlib]System.Delegate)
IL_0016: castclass EvType
IL_001b: ldloc.0
IL_001c: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class EvType>(!!0&, !!0, !!0)
IL_0021: stloc.0
IL_0022: ldloc.0
IL_0023: ldloc.1
IL_0024: bne.un IL_0007
// end loop
IL_0029: ret
} // end of method OwningClass::add_EvName
.method public hidebysig specialname
instance void remove_EvName (
class EvType 'value'
) cil managed
{
.maxstack 3
.locals init (
[0] class EvType,
[1] class EvType
)
IL_0000: ldarg.0
IL_0001: ldfld class EvType OwningClass::EvName
IL_0006: stloc.0
// loop start (head: IL_0007)
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: ldarg.0
IL_000a: ldflda class EvType OwningClass::EvName
IL_000f: ldloc.1
IL_0010: ldarg.1
IL_0011: call class [mscorlib]System.Delegate [mscorlib]System.Delegate::Remove(class [mscorlib]System.Delegate, class [mscorlib]System.Delegate)
IL_0016: castclass EvType
IL_001b: ldloc.0
IL_001c: call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange<class EvType>(!!0&, !!0, !!0)
IL_0021: stloc.0
IL_0022: ldloc.0
IL_0023: ldloc.1
IL_0024: bne.un IL_0007
// end loop
IL_0029: ret
} // end of method OwningClass::remove_EvName
} // end of class OwningClass

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '1xvbqrhn'
.assembly AnonymousTypes
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '1xvbqrhn.dll'
// MVID: {FBEE2A5E-0EA6-4D81-AF17-0E675B5AAF7A}
.module AnonymousTypes.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
// Image base: 0x02CF0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -851,4 +847,3 @@ @@ -851,4 +847,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\work\ILSpy\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\AnonymousTypes.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AnonymousTypes.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly ikebg3tc
.assembly AnonymousTypes.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ikebg3tc.dll
// MVID: {9F96FB3A-745D-4BC1-8552-8ECB86372E2A}
.module AnonymousTypes.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
// Image base: 0x03680000
// =============== CLASS MEMBERS DECLARATION ===================
@ -746,4 +742,3 @@ @@ -746,4 +742,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\work\ILSpy\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\AnonymousTypes.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Async.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '0bl3wgec'
.assembly Async
{
.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '0bl3wgec.dll'
// MVID: {D5634CE0-620A-4F18-AC07-9132CB05EFF7}
.module Async.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
// Image base: 0x00930000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1604,4 +1600,3 @@ @@ -1604,4 +1600,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Async.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Async.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '5wwmyl42'
.assembly Async.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '5wwmyl42.dll'
// MVID: {91D59E53-2AA6-427F-B57D-0FC8808BA12D}
.module Async.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
// Image base: 0x00A20000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1433,4 +1429,3 @@ @@ -1433,4 +1429,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Async.opt.res

11
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.cs

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
// TODO : maybe use single-line formatting in this case?
internal class AutoProperties
@ -20,5 +22,12 @@ @@ -20,5 +22,12 @@
get;
set;
} = 4;
[Obsolete("Property")]
[field: Obsolete("Field")]
public int PropertyWithAttributeOnBackingField {
get;
set;
}
}
}

32
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.opt.roslyn.il

@ -44,6 +44,9 @@ @@ -44,6 +44,9 @@
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private static int32 '<D>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private int32 '<PropertyWithAttributeOnBackingField>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 05 46 69 65 6C 64 00 00 ) // ...Field..
.method public hidebysig specialname instance int32
get_A() cil managed
{
@ -109,6 +112,29 @@ @@ -109,6 +112,29 @@
IL_0006: ret
} // end of method AutoProperties::set_D
.method public hidebysig specialname instance int32
get_PropertyWithAttributeOnBackingField() 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.AutoProperties::'<PropertyWithAttributeOnBackingField>k__BackingField'
IL_0006: ret
} // end of method AutoProperties::get_PropertyWithAttributeOnBackingField
.method public hidebysig specialname instance void
set_PropertyWithAttributeOnBackingField(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.AutoProperties::'<PropertyWithAttributeOnBackingField>k__BackingField'
IL_0007: ret
} // end of method AutoProperties::set_PropertyWithAttributeOnBackingField
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -155,6 +181,12 @@ @@ -155,6 +181,12 @@
.get int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::get_D()
.set void ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::set_D(int32)
} // end of property AutoProperties::D
.property instance int32 PropertyWithAttributeOnBackingField()
{
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 08 50 72 6F 70 65 72 74 79 00 00 ) // ...Property..
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::get_PropertyWithAttributeOnBackingField()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::set_PropertyWithAttributeOnBackingField(int32)
} // end of property AutoProperties::PropertyWithAttributeOnBackingField
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties

33
ICSharpCode.Decompiler.Tests/TestCases/Pretty/AutoProperties.roslyn.il

@ -48,6 +48,10 @@ @@ -48,6 +48,10 @@
.field private static int32 '<D>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 '<PropertyWithAttributeOnBackingField>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 )
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 05 46 69 65 6C 64 00 00 ) // ...Field..
.method public hidebysig specialname instance int32
get_A() cil managed
{
@ -113,6 +117,29 @@ @@ -113,6 +117,29 @@
IL_0006: ret
} // end of method AutoProperties::set_D
.method public hidebysig specialname instance int32
get_PropertyWithAttributeOnBackingField() 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.AutoProperties::'<PropertyWithAttributeOnBackingField>k__BackingField'
IL_0006: ret
} // end of method AutoProperties::get_PropertyWithAttributeOnBackingField
.method public hidebysig specialname instance void
set_PropertyWithAttributeOnBackingField(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.AutoProperties::'<PropertyWithAttributeOnBackingField>k__BackingField'
IL_0007: ret
} // end of method AutoProperties::set_PropertyWithAttributeOnBackingField
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -160,6 +187,12 @@ @@ -160,6 +187,12 @@
.get int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::get_D()
.set void ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::set_D(int32)
} // end of property AutoProperties::D
.property instance int32 PropertyWithAttributeOnBackingField()
{
.custom instance void [mscorlib]System.ObsoleteAttribute::.ctor(string) = ( 01 00 08 50 72 6F 70 65 72 74 79 00 00 ) // ...Property..
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::get_PropertyWithAttributeOnBackingField()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties::set_PropertyWithAttributeOnBackingField(int32)
} // end of property AutoProperties::PropertyWithAttributeOnBackingField
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.AutoProperties

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CheckedUnchecked.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly rbj4xpgi
.assembly CheckedUnchecked
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module rbj4xpgi.dll
// MVID: {45787808-282D-44B8-BFE5-F8F3EF6DDA83}
.module CheckedUnchecked.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
// Image base: 0x005F0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -634,4 +630,3 @@ @@ -634,4 +630,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\CheckedUnchecked.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CheckedUnchecked.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly j4foxgdl
.assembly CheckedUnchecked.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module j4foxgdl.dll
// MVID: {C884AA00-D1B2-4593-9A69-3DBFE92E25C4}
.module CheckedUnchecked.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
// Image base: 0x02F90000
// =============== CLASS MEMBERS DECLARATION ===================
@ -548,4 +544,3 @@ @@ -548,4 +544,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\CheckedUnchecked.opt.res

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/DelegateConstruction.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -15,7 +13,7 @@ @@ -15,7 +13,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly awc2kjfz
.assembly DelegateConstruction
{
.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.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
@ -26,15 +24,13 @@ @@ -26,15 +24,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module awc2kjfz.dll
// MVID: {49C8B10E-CA57-40C1-9484-BC8636C38817}
.module DelegateConstruction.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
// Image base: 0x04D50000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1763,4 +1759,3 @@ @@ -1763,4 +1759,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\DelegateConstruction.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/DelegateConstruction.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -15,7 +13,7 @@ @@ -15,7 +13,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly ci3jaj4f
.assembly DelegateConstruction.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.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
@ -26,15 +24,13 @@ @@ -26,15 +24,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ci3jaj4f.dll
// MVID: {F860E23B-9B90-453A-A3A5-49C4D5AA91F8}
.module DelegateConstruction.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
// Image base: 0x05340000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1460,4 +1456,3 @@ @@ -1460,4 +1456,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\DelegateConstruction.opt.res

8
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.cs

@ -188,6 +188,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -188,6 +188,12 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
public void ThrowInFinally()
{
try {
} finally {
throw new Exception();
}
}
}
}

32
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly vicbdq3v
.assembly ExceptionHandling
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module vicbdq3v.dll
// MVID: {5E2AA050-D333-4323-8C5A-29B86C8D98BB}
.module ExceptionHandling.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
// Image base: 0x01160000
// =============== CLASS MEMBERS DECLARATION ===================
@ -415,6 +411,29 @@ @@ -415,6 +411,29 @@
IL_0022: ret
} // end of method ExceptionHandling::NoUsingStatementBecauseTheVariableIsAssignedTo
.method public hidebysig instance void
ThrowInFinally() cil managed
{
// Code size 14 (0xe)
.maxstack 1
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: nop
IL_0003: leave.s IL_000c
} // end .try
finally
{
IL_0005: nop
IL_0006: newobj instance void [mscorlib]System.Exception::.ctor()
IL_000b: throw
} // end handler
IL_000c: br.s IL_000c
} // end of method ExceptionHandling::ThrowInFinally
.method family hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -431,4 +450,3 @@ @@ -431,4 +450,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\ExceptionHandling.res

28
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly uidw4n1e
.assembly ExceptionHandling.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module uidw4n1e.dll
// MVID: {A6A100AA-2C72-4B40-9C9F-50DA438D4727}
.module ExceptionHandling.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
// Image base: 0x00380000
// =============== CLASS MEMBERS DECLARATION ===================
@ -322,6 +318,25 @@ @@ -322,6 +318,25 @@
IL_0014: ret
} // end of method ExceptionHandling::NoUsingStatementBecauseTheVariableIsAssignedTo
.method public hidebysig instance void
ThrowInFinally() cil managed
{
// Code size 10 (0xa)
.maxstack 1
.try
{
IL_0000: leave.s IL_0008
} // end .try
finally
{
IL_0002: newobj instance void [mscorlib]System.Exception::.ctor()
IL_0007: throw
} // end handler
IL_0008: br.s IL_0008
} // end of method ExceptionHandling::ThrowInFinally
.method family hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -338,4 +353,3 @@ @@ -338,4 +353,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\ExceptionHandling.opt.res

19
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.opt.roslyn.il

@ -670,6 +670,25 @@ @@ -670,6 +670,25 @@
IL_0014: ret
} // end of method ExceptionHandling::NoUsingStatementBecauseTheVariableIsAssignedTo
.method public hidebysig instance void
ThrowInFinally() cil managed
{
// Code size 10 (0xa)
.maxstack 1
.try
{
IL_0000: leave.s IL_0008
} // end .try
finally
{
IL_0002: newobj instance void [mscorlib]System.Exception::.ctor()
IL_0007: throw
} // end handler
IL_0008: br.s IL_0008
} // end of method ExceptionHandling::ThrowInFinally
.method family hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

23
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.roslyn.il

@ -831,6 +831,29 @@ @@ -831,6 +831,29 @@
IL_0021: ret
} // end of method ExceptionHandling::NoUsingStatementBecauseTheVariableIsAssignedTo
.method public hidebysig instance void
ThrowInFinally() cil managed
{
// Code size 14 (0xe)
.maxstack 1
IL_0000: nop
.try
{
IL_0001: nop
IL_0002: nop
IL_0003: leave.s IL_000c
} // end .try
finally
{
IL_0005: nop
IL_0006: newobj instance void [mscorlib]System.Exception::.ctor()
IL_000b: throw
} // end handler
IL_000c: br.s IL_000c
} // end of method ExceptionHandling::ThrowInFinally
.method family hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

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

@ -218,7 +218,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -218,7 +218,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public void MembersBuiltin()
{
ToCode(X(), () => 1.23m.ToString());
ToCode(X(), () => ((Enum)(object)AttributeTargets.All).HasFlag((Enum)AttributeTargets.Assembly));
ToCode(X(), () => AttributeTargets.All.HasFlag((Enum)AttributeTargets.Assembly));
ToCode(X(), () => "abc".Length == 3);
ToCode(X(), () => 'a'.CompareTo('b') < 0);
}

21
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -20,7 +18,7 @@ @@ -20,7 +18,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '3qhjq0hu'
.assembly ExpressionTrees
{
.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.
@ -30,15 +28,13 @@ @@ -30,15 +28,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '3qhjq0hu.dll'
// MVID: {426C7905-90B3-4EA8-8585-F907E00CBDB7}
.module ExpressionTrees.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
// Image base: 0x02FC0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -9909,7 +9905,7 @@ @@ -9909,7 +9905,7 @@
IL_0000: ldc.i4.3
IL_0001: newarr [mscorlib]System.Int32
IL_0006: dup
IL_0007: ldtoken field valuetype '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'::'$$method0x60000bc-1'
IL_0007: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x60000bc-1'
IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0011: stloc.0
@ -9985,7 +9981,7 @@ @@ -9985,7 +9981,7 @@
IL_0009: ldc.i4.3
IL_000a: newarr [mscorlib]System.Int32
IL_000f: dup
IL_0010: ldtoken field valuetype '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'::'$$method0x60000c0-1'
IL_0010: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x60000c0-1'
IL_0015: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001a: stelem.ref
@ -10676,7 +10672,7 @@ @@ -10676,7 +10672,7 @@
} // end of property '<>f__AnonymousType1`2'::Y
} // end of class '<>f__AnonymousType1`2'
.class private auto ansi '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'
.class private auto ansi '<PrivateImplementationDetails>'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
@ -10687,9 +10683,9 @@ @@ -10687,9 +10683,9 @@
.size 12
} // end of class '__StaticArrayInitTypeSize=12'
.field static assembly valuetype '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'/'__StaticArrayInitTypeSize=12' '$$method0x60000bc-1' at I_00007A38
.field static assembly valuetype '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'/'__StaticArrayInitTypeSize=12' '$$method0x60000c0-1' at I_00007AB0
} // end of class '<PrivateImplementationDetails>{426C7905-90B3-4EA8-8585-F907E00CBDB7}'
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x60000bc-1' at I_00007A38
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x60000c0-1' at I_00007AB0
} // end of class '<PrivateImplementationDetails>'
.class private auto ansi sealed beforefieldinit '<>f__AnonymousType2`2'<'<A>j__TPar','<B>j__TPar'>
extends [mscorlib]System.Object
@ -10886,4 +10882,3 @@ @@ -10886,4 +10882,3 @@
.data cil I_00007AB0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00)
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\ExpressionTrees.res

21
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -20,7 +18,7 @@ @@ -20,7 +18,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tngduxjw
.assembly ExpressionTrees.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.
@ -30,15 +28,13 @@ @@ -30,15 +28,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tngduxjw.dll
// MVID: {416BD71B-B506-4355-8604-9F8C6A2FDEE6}
.module ExpressionTrees.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
// Image base: 0x04A60000
// =============== CLASS MEMBERS DECLARATION ===================
@ -9453,7 +9449,7 @@ @@ -9453,7 +9449,7 @@
IL_0000: ldc.i4.3
IL_0001: newarr [mscorlib]System.Int32
IL_0006: dup
IL_0007: ldtoken field valuetype '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'::'$$method0x60000bc-1'
IL_0007: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x60000bc-1'
IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0011: ret
@ -9509,7 +9505,7 @@ @@ -9509,7 +9505,7 @@
IL_0009: ldc.i4.3
IL_000a: newarr [mscorlib]System.Int32
IL_000f: dup
IL_0010: ldtoken field valuetype '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'::'$$method0x60000c0-1'
IL_0010: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x60000c0-1'
IL_0015: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001a: stelem.ref
@ -10095,7 +10091,7 @@ @@ -10095,7 +10091,7 @@
} // end of property '<>f__AnonymousType1`2'::Y
} // end of class '<>f__AnonymousType1`2'
.class private auto ansi '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'
.class private auto ansi '<PrivateImplementationDetails>'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
@ -10106,9 +10102,9 @@ @@ -10106,9 +10102,9 @@
.size 12
} // end of class '__StaticArrayInitTypeSize=12'
.field static assembly valuetype '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'/'__StaticArrayInitTypeSize=12' '$$method0x60000bc-1' at I_00007670
.field static assembly valuetype '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'/'__StaticArrayInitTypeSize=12' '$$method0x60000c0-1' at I_000076A8
} // end of class '<PrivateImplementationDetails>{416BD71B-B506-4355-8604-9F8C6A2FDEE6}'
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x60000bc-1' at I_00007670
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x60000c0-1' at I_000076A8
} // end of class '<PrivateImplementationDetails>'
.class private auto ansi sealed beforefieldinit '<>f__AnonymousType2`2'<'<A>j__TPar','<B>j__TPar'>
extends [mscorlib]System.Object
@ -10279,4 +10275,3 @@ @@ -10279,4 +10275,3 @@
.data cil I_000076A8 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00)
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\ExpressionTrees.opt.res

170
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.opt.roslyn.il

@ -3117,7 +3117,7 @@ @@ -3117,7 +3117,7 @@
.method public hidebysig instance void
MembersBuiltin() cil managed
{
// Code size 431 (0x1af)
// Code size 401 (0x191)
.maxstack 8
IL_0000: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_0005: ldc.i4.s 123
@ -3157,108 +3157,100 @@ @@ -3157,108 +3157,100 @@
IL_0063: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0068: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_006d: ldtoken [mscorlib]System.Object
IL_0072: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0077: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Type)
IL_007c: ldtoken [mscorlib]System.Enum
IL_0081: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0086: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Type)
IL_008b: ldtoken method instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0090: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_0095: castclass [mscorlib]System.Reflection.MethodInfo
IL_009a: ldc.i4.1
IL_009b: newarr [System.Core]System.Linq.Expressions.Expression
IL_00a0: dup
IL_00a1: ldc.i4.0
IL_00a2: ldc.i4.1
IL_00a3: box [mscorlib]System.AttributeTargets
IL_00a8: ldtoken [mscorlib]System.AttributeTargets
IL_00ad: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00b2: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_00b7: ldtoken [mscorlib]System.Enum
IL_00bc: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00c1: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
IL_006d: ldtoken method instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0072: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_0077: castclass [mscorlib]System.Reflection.MethodInfo
IL_007c: ldc.i4.1
IL_007d: newarr [System.Core]System.Linq.Expressions.Expression
IL_0082: dup
IL_0083: ldc.i4.0
IL_0084: ldc.i4.1
IL_0085: box [mscorlib]System.AttributeTargets
IL_008a: ldtoken [mscorlib]System.AttributeTargets
IL_008f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0094: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0099: ldtoken [mscorlib]System.Enum
IL_009e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00a3: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Type)
IL_00c6: stelem.ref
IL_00c7: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
IL_00a8: stelem.ref
IL_00a9: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Reflection.MethodInfo,
class [System.Core]System.Linq.Expressions.Expression[])
IL_00cc: ldc.i4.0
IL_00cd: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_00d2: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
IL_00ae: ldc.i4.0
IL_00af: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_00b4: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.ParameterExpression[])
IL_00d7: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
IL_00b9: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
class [System.Core]System.Linq.Expressions.Expression`1<class [mscorlib]System.Func`1<!!0>>)
IL_00dc: pop
IL_00dd: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_00e2: ldstr "abc"
IL_00e7: ldtoken [mscorlib]System.String
IL_00ec: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00f1: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_00f6: ldtoken method instance int32 [mscorlib]System.String::get_Length()
IL_00fb: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_0100: castclass [mscorlib]System.Reflection.MethodInfo
IL_0105: call class [System.Core]System.Linq.Expressions.MemberExpression [System.Core]System.Linq.Expressions.Expression::Property(class [System.Core]System.Linq.Expressions.Expression,
IL_00be: pop
IL_00bf: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_00c4: ldstr "abc"
IL_00c9: ldtoken [mscorlib]System.String
IL_00ce: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00d3: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_00d8: ldtoken method instance int32 [mscorlib]System.String::get_Length()
IL_00dd: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_00e2: castclass [mscorlib]System.Reflection.MethodInfo
IL_00e7: call class [System.Core]System.Linq.Expressions.MemberExpression [System.Core]System.Linq.Expressions.Expression::Property(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Reflection.MethodInfo)
IL_010a: ldc.i4.3
IL_010b: box [mscorlib]System.Int32
IL_0110: ldtoken [mscorlib]System.Int32
IL_0115: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_011a: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
IL_00ec: ldc.i4.3
IL_00ed: box [mscorlib]System.Int32
IL_00f2: ldtoken [mscorlib]System.Int32
IL_00f7: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00fc: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_011f: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::Equal(class [System.Core]System.Linq.Expressions.Expression,
IL_0101: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::Equal(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.Expression)
IL_0124: ldc.i4.0
IL_0125: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_012a: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
IL_0106: ldc.i4.0
IL_0107: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_010c: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.ParameterExpression[])
IL_012f: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
IL_0111: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
class [System.Core]System.Linq.Expressions.Expression`1<class [mscorlib]System.Func`1<!!0>>)
IL_0134: pop
IL_0135: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_013a: ldc.i4.s 97
IL_013c: box [mscorlib]System.Char
IL_0141: ldtoken [mscorlib]System.Char
IL_0146: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_014b: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0150: ldtoken method instance int32 [mscorlib]System.Char::CompareTo(char)
IL_0155: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_015a: castclass [mscorlib]System.Reflection.MethodInfo
IL_015f: ldc.i4.1
IL_0160: newarr [System.Core]System.Linq.Expressions.Expression
IL_0165: dup
IL_0166: ldc.i4.0
IL_0167: ldc.i4.s 98
IL_0169: box [mscorlib]System.Char
IL_016e: ldtoken [mscorlib]System.Char
IL_0173: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0178: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_017d: stelem.ref
IL_017e: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
IL_0116: pop
IL_0117: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_011c: ldc.i4.s 97
IL_011e: box [mscorlib]System.Char
IL_0123: ldtoken [mscorlib]System.Char
IL_0128: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_012d: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0132: ldtoken method instance int32 [mscorlib]System.Char::CompareTo(char)
IL_0137: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_013c: castclass [mscorlib]System.Reflection.MethodInfo
IL_0141: ldc.i4.1
IL_0142: newarr [System.Core]System.Linq.Expressions.Expression
IL_0147: dup
IL_0148: ldc.i4.0
IL_0149: ldc.i4.s 98
IL_014b: box [mscorlib]System.Char
IL_0150: ldtoken [mscorlib]System.Char
IL_0155: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_015a: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_015f: stelem.ref
IL_0160: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Reflection.MethodInfo,
class [System.Core]System.Linq.Expressions.Expression[])
IL_0183: ldc.i4.0
IL_0184: box [mscorlib]System.Int32
IL_0189: ldtoken [mscorlib]System.Int32
IL_018e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0193: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
IL_0165: ldc.i4.0
IL_0166: box [mscorlib]System.Int32
IL_016b: ldtoken [mscorlib]System.Int32
IL_0170: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0175: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0198: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::LessThan(class [System.Core]System.Linq.Expressions.Expression,
IL_017a: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::LessThan(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.Expression)
IL_019d: ldc.i4.0
IL_019e: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_01a3: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
IL_017f: ldc.i4.0
IL_0180: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_0185: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.ParameterExpression[])
IL_01a8: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
IL_018a: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
class [System.Core]System.Linq.Expressions.Expression`1<class [mscorlib]System.Func`1<!!0>>)
IL_01ad: pop
IL_01ae: ret
IL_018f: pop
IL_0190: ret
} // end of method ExpressionTrees::MembersBuiltin
.method public hidebysig instance void
@ -9680,12 +9672,12 @@ @@ -9680,12 +9672,12 @@
.size 12
} // end of class '__StaticArrayInitTypeSize=12'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' E429CCA3F703A39CC5954A6572FEC9086135B34E at I_0000BDA0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' E429CCA3F703A39CC5954A6572FEC9086135B34E at I_0000BD84
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_0000BDA0 = bytearray (
.data cil I_0000BD84 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00)
// *********** DISASSEMBLY COMPLETE ***********************

170
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExpressionTrees.roslyn.il

@ -3201,7 +3201,7 @@ @@ -3201,7 +3201,7 @@
.method public hidebysig instance void
MembersBuiltin() cil managed
{
// Code size 432 (0x1b0)
// Code size 402 (0x192)
.maxstack 8
IL_0000: nop
IL_0001: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
@ -3242,108 +3242,100 @@ @@ -3242,108 +3242,100 @@
IL_0064: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0069: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_006e: ldtoken [mscorlib]System.Object
IL_0073: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0078: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Type)
IL_007d: ldtoken [mscorlib]System.Enum
IL_0082: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0087: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Type)
IL_008c: ldtoken method instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0091: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_0096: castclass [mscorlib]System.Reflection.MethodInfo
IL_009b: ldc.i4.1
IL_009c: newarr [System.Core]System.Linq.Expressions.Expression
IL_00a1: dup
IL_00a2: ldc.i4.0
IL_00a3: ldc.i4.1
IL_00a4: box [mscorlib]System.AttributeTargets
IL_00a9: ldtoken [mscorlib]System.AttributeTargets
IL_00ae: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00b3: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_00b8: ldtoken [mscorlib]System.Enum
IL_00bd: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00c2: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
IL_006e: ldtoken method instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0073: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_0078: castclass [mscorlib]System.Reflection.MethodInfo
IL_007d: ldc.i4.1
IL_007e: newarr [System.Core]System.Linq.Expressions.Expression
IL_0083: dup
IL_0084: ldc.i4.0
IL_0085: ldc.i4.1
IL_0086: box [mscorlib]System.AttributeTargets
IL_008b: ldtoken [mscorlib]System.AttributeTargets
IL_0090: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0095: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_009a: ldtoken [mscorlib]System.Enum
IL_009f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00a4: call class [System.Core]System.Linq.Expressions.UnaryExpression [System.Core]System.Linq.Expressions.Expression::Convert(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Type)
IL_00c7: stelem.ref
IL_00c8: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
IL_00a9: stelem.ref
IL_00aa: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Reflection.MethodInfo,
class [System.Core]System.Linq.Expressions.Expression[])
IL_00cd: ldc.i4.0
IL_00ce: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_00d3: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
IL_00af: ldc.i4.0
IL_00b0: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_00b5: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.ParameterExpression[])
IL_00d8: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
IL_00ba: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
class [System.Core]System.Linq.Expressions.Expression`1<class [mscorlib]System.Func`1<!!0>>)
IL_00dd: pop
IL_00de: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_00e3: ldstr "abc"
IL_00e8: ldtoken [mscorlib]System.String
IL_00ed: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00f2: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_00f7: ldtoken method instance int32 [mscorlib]System.String::get_Length()
IL_00fc: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_0101: castclass [mscorlib]System.Reflection.MethodInfo
IL_0106: call class [System.Core]System.Linq.Expressions.MemberExpression [System.Core]System.Linq.Expressions.Expression::Property(class [System.Core]System.Linq.Expressions.Expression,
IL_00bf: pop
IL_00c0: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_00c5: ldstr "abc"
IL_00ca: ldtoken [mscorlib]System.String
IL_00cf: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00d4: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_00d9: ldtoken method instance int32 [mscorlib]System.String::get_Length()
IL_00de: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_00e3: castclass [mscorlib]System.Reflection.MethodInfo
IL_00e8: call class [System.Core]System.Linq.Expressions.MemberExpression [System.Core]System.Linq.Expressions.Expression::Property(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Reflection.MethodInfo)
IL_010b: ldc.i4.3
IL_010c: box [mscorlib]System.Int32
IL_0111: ldtoken [mscorlib]System.Int32
IL_0116: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_011b: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
IL_00ed: ldc.i4.3
IL_00ee: box [mscorlib]System.Int32
IL_00f3: ldtoken [mscorlib]System.Int32
IL_00f8: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_00fd: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0120: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::Equal(class [System.Core]System.Linq.Expressions.Expression,
IL_0102: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::Equal(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.Expression)
IL_0125: ldc.i4.0
IL_0126: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_012b: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
IL_0107: ldc.i4.0
IL_0108: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_010d: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.ParameterExpression[])
IL_0130: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
IL_0112: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
class [System.Core]System.Linq.Expressions.Expression`1<class [mscorlib]System.Func`1<!!0>>)
IL_0135: pop
IL_0136: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_013b: ldc.i4.s 97
IL_013d: box [mscorlib]System.Char
IL_0142: ldtoken [mscorlib]System.Char
IL_0147: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_014c: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0151: ldtoken method instance int32 [mscorlib]System.Char::CompareTo(char)
IL_0156: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_015b: castclass [mscorlib]System.Reflection.MethodInfo
IL_0160: ldc.i4.1
IL_0161: newarr [System.Core]System.Linq.Expressions.Expression
IL_0166: dup
IL_0167: ldc.i4.0
IL_0168: ldc.i4.s 98
IL_016a: box [mscorlib]System.Char
IL_016f: ldtoken [mscorlib]System.Char
IL_0174: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0179: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_017e: stelem.ref
IL_017f: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
IL_0117: pop
IL_0118: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::X()
IL_011d: ldc.i4.s 97
IL_011f: box [mscorlib]System.Char
IL_0124: ldtoken [mscorlib]System.Char
IL_0129: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_012e: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0133: ldtoken method instance int32 [mscorlib]System.Char::CompareTo(char)
IL_0138: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle)
IL_013d: castclass [mscorlib]System.Reflection.MethodInfo
IL_0142: ldc.i4.1
IL_0143: newarr [System.Core]System.Linq.Expressions.Expression
IL_0148: dup
IL_0149: ldc.i4.0
IL_014a: ldc.i4.s 98
IL_014c: box [mscorlib]System.Char
IL_0151: ldtoken [mscorlib]System.Char
IL_0156: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_015b: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0160: stelem.ref
IL_0161: call class [System.Core]System.Linq.Expressions.MethodCallExpression [System.Core]System.Linq.Expressions.Expression::Call(class [System.Core]System.Linq.Expressions.Expression,
class [mscorlib]System.Reflection.MethodInfo,
class [System.Core]System.Linq.Expressions.Expression[])
IL_0184: ldc.i4.0
IL_0185: box [mscorlib]System.Int32
IL_018a: ldtoken [mscorlib]System.Int32
IL_018f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0194: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
IL_0166: ldc.i4.0
IL_0167: box [mscorlib]System.Int32
IL_016c: ldtoken [mscorlib]System.Int32
IL_0171: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
IL_0176: call class [System.Core]System.Linq.Expressions.ConstantExpression [System.Core]System.Linq.Expressions.Expression::Constant(object,
class [mscorlib]System.Type)
IL_0199: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::LessThan(class [System.Core]System.Linq.Expressions.Expression,
IL_017b: call class [System.Core]System.Linq.Expressions.BinaryExpression [System.Core]System.Linq.Expressions.Expression::LessThan(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.Expression)
IL_019e: ldc.i4.0
IL_019f: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_01a4: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
IL_0180: ldc.i4.0
IL_0181: newarr [System.Core]System.Linq.Expressions.ParameterExpression
IL_0186: call class [System.Core]System.Linq.Expressions.Expression`1<!!0> [System.Core]System.Linq.Expressions.Expression::Lambda<class [mscorlib]System.Func`1<bool>>(class [System.Core]System.Linq.Expressions.Expression,
class [System.Core]System.Linq.Expressions.ParameterExpression[])
IL_01a9: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
IL_018b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.ExpressionTrees::ToCode<bool>(object,
class [System.Core]System.Linq.Expressions.Expression`1<class [mscorlib]System.Func`1<!!0>>)
IL_01ae: pop
IL_01af: ret
IL_0190: pop
IL_0191: ret
} // end of method ExpressionTrees::MembersBuiltin
.method public hidebysig instance void
@ -9927,12 +9919,12 @@ @@ -9927,12 +9919,12 @@
.size 12
} // end of class '__StaticArrayInitTypeSize=12'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' E429CCA3F703A39CC5954A6572FEC9086135B34E at I_0000C030
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' E429CCA3F703A39CC5954A6572FEC9086135B34E at I_0000C014
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_0000C030 = bytearray (
.data cil I_0000C014 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00)
// *********** DISASSEMBLY COMPLETE ***********************

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

@ -32,7 +32,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty @@ -32,7 +32,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty
{
protected internal IEnumerable<string> Test2(string test)
{
yield return Test(test);
yield return base.Test(test);
}
}

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly kjibydgt
.assembly FixProxyCalls
{
.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module kjibydgt.dll
// MVID: {7F7E319E-D28C-421B-B3A6-A5F71C1BC3A5}
.module FixProxyCalls.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
// Image base: 0x02700000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1576,4 +1572,3 @@ @@ -1576,4 +1572,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// Warnung: Win32-Ressourcendatei "../../../TestCases/Pretty\FixProxyCalls.res" wurde erstellt.

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly b0rqcnnq
.assembly FixProxyCalls.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module b0rqcnnq.dll
// MVID: {D8989CD1-06F3-4E8C-8C4C-7F7B95ACB488}
.module FixProxyCalls.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
// Image base: 0x00810000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1320,4 +1316,3 @@ @@ -1320,4 +1316,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// Warnung: Win32-Ressourcendatei "../../../TestCases/Pretty\FixProxyCalls.opt.res" wurde erstellt.

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly hdkktc2j
.assembly Generics
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module hdkktc2j.dll
// MVID: {E1E1D350-F9F6-4498-A05D-8F728F6F95CE}
.module Generics.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
// Image base: 0x04410000
// =============== CLASS MEMBERS DECLARATION ===================
@ -310,4 +306,3 @@ @@ -310,4 +306,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\work\ILSpy\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\Generics.res

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly qmjsj0bc
.assembly Generics.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module qmjsj0bc.dll
// MVID: {A13EDBC1-FA83-4831-BCEB-F1A730B462DC}
.module Generics.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
// Image base: 0x03640000
// =============== CLASS MEMBERS DECLARATION ===================
@ -243,4 +239,3 @@ @@ -243,4 +239,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\work\ILSpy\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\Generics.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/HelloWorld.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '5iai3vtm'
.assembly HelloWorld
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '5iai3vtm.dll'
// MVID: {66BA676E-A1AF-4531-9C09-198436A0A184}
.module HelloWorld.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
// Image base: 0x00CC0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -63,4 +59,3 @@ @@ -63,4 +59,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../Tests/TestCases/Pretty\HelloWorld.res

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

@ -197,6 +197,27 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -197,6 +197,27 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
return c;
}
public static void InvalidIndices(int a)
{
int[] array = new int[1];
array[1] = a;
X(Y(), array);
}
public static void InvalidIndices2(int a)
{
int[] array = new int[1];
array[-1] = a;
X(Y(), array);
}
public static void IndicesInWrongOrder(int a, int b)
{
int[] array = new int[5];
array[2] = b;
array[1] = a;
X(Y(), array);
}
public static void CollectionInitializerList()
{

77
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -15,7 +13,7 @@ @@ -15,7 +13,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly rzivg0mq
.assembly InitializerTests
{
.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
@ -25,15 +23,13 @@ @@ -25,15 +23,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module rzivg0mq.dll
// MVID: {66592AAC-07E3-4F52-A96F-0428775E7A0F}
.module InitializerTests.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
// Image base: 0x00E00000
// =============== CLASS MEMBERS DECLARATION ===================
@ -775,6 +771,74 @@ @@ -775,6 +771,74 @@
IL_002b: ret
} // end of method InitializerTests::Test4
.method public hidebysig static void InvalidIndices(int32 a) cil managed
{
// Code size 25 (0x19)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.1
IL_0002: newarr [mscorlib]System.Int32
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.1
IL_000a: ldarg.0
IL_000b: stelem.i4
IL_000c: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0011: ldloc.0
IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0017: nop
IL_0018: ret
} // end of method InitializerTests::InvalidIndices
.method public hidebysig static void InvalidIndices2(int32 a) cil managed
{
// Code size 25 (0x19)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.1
IL_0002: newarr [mscorlib]System.Int32
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.m1
IL_000a: ldarg.0
IL_000b: stelem.i4
IL_000c: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0011: ldloc.0
IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0017: nop
IL_0018: ret
} // end of method InitializerTests::InvalidIndices2
.method public hidebysig static void IndicesInWrongOrder(int32 a,
int32 b) cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.5
IL_0002: newarr [mscorlib]System.Int32
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.2
IL_000a: ldarg.1
IL_000b: stelem.i4
IL_000c: ldloc.0
IL_000d: ldc.i4.1
IL_000e: ldarg.0
IL_000f: stelem.i4
IL_0010: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0015: ldloc.0
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_001b: nop
IL_001c: ret
} // end of method InitializerTests::IndicesInWrongOrder
.method public hidebysig static void CollectionInitializerList() cil managed
{
// Code size 44 (0x2c)
@ -1549,4 +1613,3 @@ @@ -1549,4 +1613,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\InitializerTests.res

71
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -15,7 +13,7 @@ @@ -15,7 +13,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly n52bfodk
.assembly InitializerTests.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
@ -25,15 +23,13 @@ @@ -25,15 +23,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module n52bfodk.dll
// MVID: {2B30E2AC-D797-4A69-ACEC-93251C343504}
.module InitializerTests.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
// Image base: 0x037A0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -658,6 +654,68 @@ @@ -658,6 +654,68 @@
IL_0026: ret
} // end of method InitializerTests::Test4
.method public hidebysig static void InvalidIndices(int32 a) cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: ldc.i4.1
IL_0001: newarr [mscorlib]System.Int32
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.1
IL_0009: ldarg.0
IL_000a: stelem.i4
IL_000b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0010: ldloc.0
IL_0011: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0016: ret
} // end of method InitializerTests::InvalidIndices
.method public hidebysig static void InvalidIndices2(int32 a) cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: ldc.i4.1
IL_0001: newarr [mscorlib]System.Int32
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.m1
IL_0009: ldarg.0
IL_000a: stelem.i4
IL_000b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0010: ldloc.0
IL_0011: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0016: ret
} // end of method InitializerTests::InvalidIndices2
.method public hidebysig static void IndicesInWrongOrder(int32 a,
int32 b) cil managed
{
// Code size 27 (0x1b)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: ldc.i4.5
IL_0001: newarr [mscorlib]System.Int32
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.2
IL_0009: ldarg.1
IL_000a: stelem.i4
IL_000b: ldloc.0
IL_000c: ldc.i4.1
IL_000d: ldarg.0
IL_000e: stelem.i4
IL_000f: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0014: ldloc.0
IL_0015: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_001a: ret
} // end of method InitializerTests::IndicesInWrongOrder
.method public hidebysig static void CollectionInitializerList() cil managed
{
// Code size 39 (0x27)
@ -1304,4 +1362,3 @@ @@ -1304,4 +1362,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\InitializerTests.opt.res

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

@ -499,8 +499,8 @@ @@ -499,8 +499,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/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__23_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__43_0'
.field public static class [mscorlib]System.EventHandler '<>9__26_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__46_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -522,17 +522,17 @@ @@ -522,17 +522,17 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__23_0'(object '<p0>',
'<NotAnObjectInitializerWithEvent>b__26_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__23_0'
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__26_0'
.method assembly hidebysig instance bool
'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
'<Bug270_NestedInitialisers>b__46_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{
// Code size 17 (0x11)
.maxstack 8
@ -542,7 +542,7 @@ @@ -542,7 +542,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0010: ret
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__43_0'
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__46_0'
} // end of class '<>c'
@ -688,6 +688,68 @@ @@ -688,6 +688,68 @@
IL_0024: ret
} // end of method InitializerTests::Test4
.method public hidebysig static void InvalidIndices(int32 a) cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: ldc.i4.1
IL_0001: newarr [mscorlib]System.Int32
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.1
IL_0009: ldarg.0
IL_000a: stelem.i4
IL_000b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0010: ldloc.0
IL_0011: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0016: ret
} // end of method InitializerTests::InvalidIndices
.method public hidebysig static void InvalidIndices2(int32 a) cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: ldc.i4.1
IL_0001: newarr [mscorlib]System.Int32
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.m1
IL_0009: ldarg.0
IL_000a: stelem.i4
IL_000b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0010: ldloc.0
IL_0011: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0016: ret
} // end of method InitializerTests::InvalidIndices2
.method public hidebysig static void IndicesInWrongOrder(int32 a,
int32 b) cil managed
{
// Code size 27 (0x1b)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: ldc.i4.5
IL_0001: newarr [mscorlib]System.Int32
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.2
IL_0009: ldarg.1
IL_000a: stelem.i4
IL_000b: ldloc.0
IL_000c: ldc.i4.1
IL_000d: ldarg.0
IL_000e: stelem.i4
IL_000f: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0014: ldloc.0
IL_0015: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_001a: ret
} // end of method InitializerTests::IndicesInWrongOrder
.method public hidebysig static void CollectionInitializerList() cil managed
{
// Code size 37 (0x25)
@ -829,18 +891,18 @@ @@ -829,18 +891,18 @@
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/Data::.ctor()
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__23_0'
IL_0007: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__26_0'
IL_000c: dup
IL_000d: brtrue.s IL_0026
IL_000f: pop
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9'
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<NotAnObjectInitializerWithEvent>b__23_0'(object,
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<NotAnObjectInitializerWithEvent>b__26_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/'<>c'::'<>9__23_0'
IL_0021: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__26_0'
IL_0026: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/Data::add_TestEvent(class [mscorlib]System.EventHandler)
IL_002b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0030: ldloc.0
@ -1303,17 +1365,17 @@ @@ -1303,17 +1365,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/'<>c'::'<>9__43_0'
IL_003a: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__46_0'
IL_003f: dup
IL_0040: brtrue.s IL_0059
IL_0042: pop
IL_0043: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9'
IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__46_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/'<>c'::'<>9__43_0'
IL_0054: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__46_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>)

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

@ -526,8 +526,8 @@ @@ -526,8 +526,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/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__23_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__43_0'
.field public static class [mscorlib]System.EventHandler '<>9__26_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__46_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -550,7 +550,7 @@ @@ -550,7 +550,7 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__23_0'(object '<p0>',
'<NotAnObjectInitializerWithEvent>b__26_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed
{
// Code size 8 (0x8)
@ -559,10 +559,10 @@ @@ -559,10 +559,10 @@
IL_0001: call void [mscorlib]System.Console::WriteLine()
IL_0006: nop
IL_0007: ret
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__23_0'
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__26_0'
.method assembly hidebysig instance bool
'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
'<Bug270_NestedInitialisers>b__46_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{
// Code size 17 (0x11)
.maxstack 8
@ -572,7 +572,7 @@ @@ -572,7 +572,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0010: ret
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__43_0'
} // end of method '<>c'::'<Bug270_NestedInitialisers>b__46_0'
} // end of class '<>c'
@ -782,6 +782,74 @@ @@ -782,6 +782,74 @@
IL_002b: ret
} // end of method InitializerTests::Test4
.method public hidebysig static void InvalidIndices(int32 a) cil managed
{
// Code size 25 (0x19)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.1
IL_0002: newarr [mscorlib]System.Int32
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.1
IL_000a: ldarg.0
IL_000b: stelem.i4
IL_000c: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0011: ldloc.0
IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0017: nop
IL_0018: ret
} // end of method InitializerTests::InvalidIndices
.method public hidebysig static void InvalidIndices2(int32 a) cil managed
{
// Code size 25 (0x19)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.1
IL_0002: newarr [mscorlib]System.Int32
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.m1
IL_000a: ldarg.0
IL_000b: stelem.i4
IL_000c: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0011: ldloc.0
IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_0017: nop
IL_0018: ret
} // end of method InitializerTests::InvalidIndices2
.method public hidebysig static void IndicesInWrongOrder(int32 a,
int32 b) cil managed
{
// Code size 29 (0x1d)
.maxstack 3
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.5
IL_0002: newarr [mscorlib]System.Int32
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.2
IL_000a: ldarg.1
IL_000b: stelem.i4
IL_000c: ldloc.0
IL_000d: ldc.i4.1
IL_000e: ldarg.0
IL_000f: stelem.i4
IL_0010: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
IL_0015: ldloc.0
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::X(object,
object)
IL_001b: nop
IL_001c: ret
} // end of method InitializerTests::IndicesInWrongOrder
.method public hidebysig static void CollectionInitializerList() cil managed
{
// Code size 42 (0x2a)
@ -959,18 +1027,18 @@ @@ -959,18 +1027,18 @@
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/Data::.ctor()
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__23_0'
IL_0008: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__26_0'
IL_000d: dup
IL_000e: brtrue.s IL_0027
IL_0010: pop
IL_0011: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9'
IL_0016: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<NotAnObjectInitializerWithEvent>b__23_0'(object,
IL_0016: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<NotAnObjectInitializerWithEvent>b__26_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/'<>c'::'<>9__23_0'
IL_0022: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__26_0'
IL_0027: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/Data::add_TestEvent(class [mscorlib]System.EventHandler)
IL_002c: nop
IL_002d: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests::Y()
@ -1525,17 +1593,17 @@ @@ -1525,17 +1593,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/'<>c'::'<>9__43_0'
IL_003e: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__46_0'
IL_0043: dup
IL_0044: brtrue.s IL_005d
IL_0046: pop
IL_0047: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9'
IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__43_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<Bug270_NestedInitialisers>b__46_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/'<>c'::'<>9__43_0'
IL_0058: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests/'<>c'::'<>9__46_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>)

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InlineAssignmentTest.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly cljdpn4p
.assembly InlineAssignmentTest
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module cljdpn4p.dll
// MVID: {4E91830C-4968-4AA2-B516-7FDA32452515}
.module InlineAssignmentTest.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
// Image base: 0x006A0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -527,4 +523,3 @@ @@ -527,4 +523,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\InlineAssignmentTest.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/InlineAssignmentTest.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly jfxjxuqt
.assembly InlineAssignmentTest.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module jfxjxuqt.dll
// MVID: {862986C8-F9C1-4FF3-8646-A3CA63D29744}
.module InlineAssignmentTest.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
// Image base: 0x010B0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -428,4 +424,3 @@ @@ -428,4 +424,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\InlineAssignmentTest.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/LiftedOperators.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '35ltrsak'
.assembly LiftedOperators
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '35ltrsak.dll'
// MVID: {E2680319-4EDA-4756-B327-523DC92BF0AB}
.module LiftedOperators.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
// Image base: 0x00ED0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -6936,4 +6932,3 @@ @@ -6936,4 +6932,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\LiftedOperators.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/LiftedOperators.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.18020
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly n45w5r1e
.assembly LiftedOperators.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module n45w5r1e.dll
// MVID: {A02D3ECA-E4C6-46ED-A628-8A99594A9C16}
.module LiftedOperators.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
// Image base: 0x02DA0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -6377,4 +6373,3 @@ @@ -6377,4 +6373,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\LiftedOperators.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '1c2baaro'
.assembly Lock
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '1c2baaro.dll'
// MVID: {5FC5B58D-AAD7-4436-A58F-6F3D75486C66}
.module Lock.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
// Image base: 0x00C60000
// =============== CLASS MEMBERS DECLARATION ===================
@ -143,4 +139,3 @@ @@ -143,4 +139,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Lock.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.mcs.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly tmpE10E
.assembly Lock.mcs
{
.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.
@ -53,15 +51,13 @@ @@ -53,15 +51,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpE10E.tmp
// MVID: {0300BC49-B2EF-4506-8B74-DF85DD4F91E4}
.module Lock.mcs.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x04DB0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -136,4 +132,3 @@ @@ -136,4 +132,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Lock.mcs.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly titpuxma
.assembly Lock.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module titpuxma.dll
// MVID: {8B90EB29-A139-4376-848E-C5D4D42952F1}
.module Lock.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
// Image base: 0x02AF0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -119,4 +115,3 @@ @@ -119,4 +115,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Lock.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Lock.opt.mcs.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly tmpE3DF
.assembly Lock.opt.mcs
{
.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.
@ -53,15 +51,13 @@ @@ -53,15 +51,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpE3DF.tmp
// MVID: {2EBA312B-EF3B-4364-91A6-0062C2105169}
.module Lock.opt.mcs.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x03960000
// =============== CLASS MEMBERS DECLARATION ===================
@ -136,4 +132,3 @@ @@ -136,4 +132,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Lock.opt.mcs.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '50bjvac5'
.assembly Loops
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '50bjvac5.dll'
// MVID: {7EA9F0A8-B896-4F84-BCD8-AC7B4D44BBC0}
.module Loops.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
// Image base: 0x03450000
// =============== CLASS MEMBERS DECLARATION ===================
@ -2692,4 +2688,3 @@ @@ -2692,4 +2688,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Loops.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.mcs.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -15,7 +13,7 @@ @@ -15,7 +13,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 3:5:0:0
}
.assembly tmp92BB
.assembly Loops.mcs
{
.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.
@ -58,15 +56,13 @@ @@ -58,15 +56,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmp92BB.tmp
// MVID: {C1A55351-8EB8-4535-855C-2DDA0B7B97CF}
.module Loops.mcs.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x03820000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1943,4 +1939,3 @@ @@ -1943,4 +1939,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\Users\Siegfried\Projects\ILSpy master\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\Loops.mcs.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly ca3webe1
.assembly Loops.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ca3webe1.dll
// MVID: {3674B35A-51F1-4E0A-A67E-D7FEBA11373B}
.module Loops.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
// Image base: 0x02DA0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -2089,4 +2085,3 @@ @@ -2089,4 +2085,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Loops.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.mcs.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -15,7 +13,7 @@ @@ -15,7 +13,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 3:5:0:0
}
.assembly tmpC964
.assembly Loops.opt.mcs
{
.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.
@ -58,15 +56,13 @@ @@ -58,15 +56,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tmpC964.tmp
// MVID: {E309B5C7-312B-4338-9E32-97629EBB582F}
.module Loops.opt.mcs.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x04B70000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1943,4 +1939,3 @@ @@ -1943,4 +1939,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\Users\Siegfried\Projects\ILSpy master\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\Loops.opt.mcs.res

3
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.il

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
)
.ver 4:0:0:0
}
.assembly c0d101lq
.assembly PInvoke
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = (
01 00 08 00 00 00 00 00
@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
}
.module PInvoke
// MVID: {F608732B-D0A2-45AE-9706-B0B2379F8AAE}
.corflags 0x00000001 // ILOnly
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = (
01 00 00 00

3
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.opt.il

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
)
.ver 4:0:0:0
}
.assembly jfi2am5n
.assembly PInvoke.opt
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = (
01 00 08 00 00 00 00 00
@ -26,7 +26,6 @@ @@ -26,7 +26,6 @@
}
.module PInvoke.opt
// MVID: {8A131D15-EAC0-48F2-A958-1AF6CBD25557}
.corflags 0x00000001 // ILOnly
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = (
01 00 00 00

1
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.opt.roslyn.il

@ -29,7 +29,6 @@ @@ -29,7 +29,6 @@
}
.module PInvoke.opt.roslyn
// MVID: {63CD2985-0EDA-4C6F-91E0-BFDEBA4905D5}
.corflags 0x00000001 // ILOnly
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = (
01 00 00 00

1
ICSharpCode.Decompiler.Tests/TestCases/Pretty/PInvoke.roslyn.il

@ -29,7 +29,6 @@ @@ -29,7 +29,6 @@
}
.module PInvoke.roslyn
// MVID: {86F00A7C-01D7-4EA0-AFE1-EB3A06A0C1FD}
.corflags 0x00000001 // ILOnly
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = (
01 00 00 00

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

@ -32,11 +32,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -32,11 +32,24 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
[NonSerialized]
private int someField;
public int Value {
get;
private set;
}
#if ROSLYN
public int NotAnAutoProperty => someField;
#else
public int NotAnAutoProperty {
get {
return someField;
}
}
#endif
public event EventHandler AutomaticEvent;
[field: NonSerialized]

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly l2f5cj2d
.assembly PropertiesAndEvents
{
.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module l2f5cj2d.dll
// MVID: {B40A9FBE-DEAE-43DA-970B-68C48E122E20}
.module PropertiesAndEvents.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
// Image base: 0x00DC0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -39,34 +35,34 @@ @@ -39,34 +35,34 @@
.class interface abstract auto ansi nested private IBase
{
.method public hidebysig newslot specialname abstract virtual
instance void add_Event(class [mscorlib]System.Action 'value') cil managed
instance int32 get_Test() cil managed
{
} // end of method IBase::add_Event
} // end of method IBase::get_Test
.method public hidebysig newslot specialname abstract virtual
instance void remove_Event(class [mscorlib]System.Action 'value') cil managed
instance void set_Test(int32 'value') cil managed
{
} // end of method IBase::remove_Event
} // end of method IBase::set_Test
.method public hidebysig newslot specialname abstract virtual
instance int32 get_Test() cil managed
instance void add_Event(class [mscorlib]System.Action 'value') cil managed
{
} // end of method IBase::get_Test
} // end of method IBase::add_Event
.method public hidebysig newslot specialname abstract virtual
instance void set_Test(int32 'value') cil managed
instance void remove_Event(class [mscorlib]System.Action 'value') cil managed
{
} // end of method IBase::set_Test
} // end of method IBase::remove_Event
.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 Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
} // end of property IBase::Test
} // end of class IBase
@ -75,45 +71,45 @@ @@ -75,45 +71,45 @@
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase
{
.method private hidebysig newslot specialname virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event(class [mscorlib]System.Action 'value') cil managed
instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test() cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event
// Code size 2 (0x2)
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test
// Code size 7 (0x7)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event
IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0006: throw
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test
.method private hidebysig newslot specialname virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event(class [mscorlib]System.Action 'value') cil managed
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32 'value') cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test
.method private hidebysig newslot specialname virtual final
instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test() cil managed
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event(class [mscorlib]System.Action 'value') cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test
// Code size 7 (0x7)
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0006: throw
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test
IL_0001: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event
.method private hidebysig newslot specialname virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32 'value') cil managed
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event(class [mscorlib]System.Action 'value') cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
@ -132,11 +128,12 @@ @@ -132,11 +128,12 @@
} // end of event Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Event
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
} // end of property Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test
} // end of class Impl
.field private notserialized int32 someField
.field private class [mscorlib]System.EventHandler AutomaticEvent
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField'
@ -171,6 +168,22 @@ @@ -171,6 +168,22 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 12 (0xc)
.maxstack 1
.locals init (int32 V_0)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0007: stloc.0
IL_0008: br.s IL_000a
IL_000a: ldloc.0
IL_000b: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -382,8 +395,8 @@ @@ -382,8 +395,8 @@
IL_002c: ret
} // end of method PropertiesAndEvents::.ctor
.method private hidebysig static void '<.ctor>b__0'(object sender,
class [mscorlib]System.EventArgs e) cil managed
.method private hidebysig static void '<.ctor>b__0'(object param0,
class [mscorlib]System.EventArgs param1) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 2 (0x2)
@ -394,13 +407,13 @@ @@ -394,13 +407,13 @@
.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
{
@ -409,13 +422,16 @@ @@ -409,13 +422,16 @@
} // 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 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\PropertiesAndEvents.res

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly sagvhpmx
.assembly PropertiesAndEvents.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module sagvhpmx.dll
// MVID: {01D434AD-9489-4A19-81AE-3BC2177A09C3}
.module PropertiesAndEvents.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
// Image base: 0x02850000
// =============== CLASS MEMBERS DECLARATION ===================
@ -39,34 +35,34 @@ @@ -39,34 +35,34 @@
.class interface abstract auto ansi nested private IBase
{
.method public hidebysig newslot specialname abstract virtual
instance void add_Event(class [mscorlib]System.Action 'value') cil managed
instance int32 get_Test() cil managed
{
} // end of method IBase::add_Event
} // end of method IBase::get_Test
.method public hidebysig newslot specialname abstract virtual
instance void remove_Event(class [mscorlib]System.Action 'value') cil managed
instance void set_Test(int32 'value') cil managed
{
} // end of method IBase::remove_Event
} // end of method IBase::set_Test
.method public hidebysig newslot specialname abstract virtual
instance int32 get_Test() cil managed
instance void add_Event(class [mscorlib]System.Action 'value') cil managed
{
} // end of method IBase::get_Test
} // end of method IBase::add_Event
.method public hidebysig newslot specialname abstract virtual
instance void set_Test(int32 'value') cil managed
instance void remove_Event(class [mscorlib]System.Action 'value') cil managed
{
} // end of method IBase::set_Test
} // end of method IBase::remove_Event
.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 Test()
{
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test(int32)
} // end of property IBase::Test
} // end of class IBase
@ -75,41 +71,41 @@ @@ -75,41 +71,41 @@
implements ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase
{
.method private hidebysig newslot specialname virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event(class [mscorlib]System.Action 'value') cil managed
instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test() cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event
// Code size 1 (0x1)
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test
// Code size 6 (0x6)
.maxstack 8
IL_0000: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event
IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0005: throw
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test
.method private hidebysig newslot specialname virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event(class [mscorlib]System.Action 'value') cil managed
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32 'value') cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test
.method private hidebysig newslot specialname virtual final
instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test() cil managed
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event(class [mscorlib]System.Action 'value') cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::get_Test
// Code size 6 (0x6)
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::add_Event
// Code size 1 (0x1)
.maxstack 8
IL_0000: newobj instance void [mscorlib]System.NotImplementedException::.ctor()
IL_0005: throw
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test
IL_0000: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.add_Event
.method private hidebysig newslot specialname virtual final
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32 'value') cil managed
instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event(class [mscorlib]System.Action 'value') cil managed
{
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::set_Test
.override ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/IBase::remove_Event
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test
} // end of method Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.remove_Event
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
@ -128,11 +124,12 @@ @@ -128,11 +124,12 @@
} // end of event Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Event
.property instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
.set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.set_Test(int32)
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.get_Test()
} // end of property Impl::ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents.IBase.Test
} // end of class Impl
.field private notserialized int32 someField
.field private class [mscorlib]System.EventHandler AutomaticEvent
.field private notserialized class [mscorlib]System.EventHandler AutomaticEventWithInitializer
.field private int32 '<Value>k__BackingField'
@ -162,6 +159,16 @@ @@ -162,6 +159,16 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0006: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -342,8 +349,8 @@ @@ -342,8 +349,8 @@
IL_0029: ret
} // end of method PropertiesAndEvents::.ctor
.method private hidebysig static void '<.ctor>b__0'(object sender,
class [mscorlib]System.EventArgs e) cil managed
.method private hidebysig static void '<.ctor>b__0'(object param0,
class [mscorlib]System.EventArgs param1) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
// Code size 1 (0x1)
@ -353,13 +360,13 @@ @@ -353,13 +360,13 @@
.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
{
@ -368,13 +375,16 @@ @@ -368,13 +375,16 @@
} // 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 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\PropertiesAndEvents.opt.res

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

@ -140,7 +140,7 @@ @@ -140,7 +140,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__15_0'
.field public static class [mscorlib]System.EventHandler '<>9__18_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -162,16 +162,17 @@ @@ -162,16 +162,17 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<.ctor>b__15_0'(object '<p0>',
'<.ctor>b__18_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__15_0'
} // end of method '<>c'::'<.ctor>b__18_0'
} // end of class '<>c'
.field private notserialized int32 someField
.field private int32 '<Value>k__BackingField'
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field private class [mscorlib]System.EventHandler AutomaticEvent
@ -201,6 +202,16 @@ @@ -201,6 +202,16 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0006: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -369,18 +380,18 @@ @@ -369,18 +380,18 @@
// 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__15_0'
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_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__15_0'(object,
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__18_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__15_0'
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_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()
@ -407,6 +418,10 @@ @@ -407,6 +418,10 @@
.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 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents

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

@ -145,7 +145,7 @@ @@ -145,7 +145,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__15_0'
.field public static class [mscorlib]System.EventHandler '<>9__18_0'
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
@ -168,17 +168,18 @@ @@ -168,17 +168,18 @@
} // end of method '<>c'::.ctor
.method assembly hidebysig instance void
'<.ctor>b__15_0'(object '<p0>',
'<.ctor>b__18_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__15_0'
} // end of method '<>c'::'<.ctor>b__18_0'
} // end of class '<>c'
.field private notserialized int32 someField
.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 )
@ -211,6 +212,16 @@ @@ -211,6 +212,16 @@
IL_0007: ret
} // end of method PropertiesAndEvents::set_Value
.method public hidebysig specialname instance int32
get_NotAnAutoProperty() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::someField
IL_0006: ret
} // end of method PropertiesAndEvents::get_NotAnAutoProperty
.method public hidebysig specialname instance void
add_AutomaticEvent(class [mscorlib]System.EventHandler 'value') cil managed
{
@ -383,18 +394,18 @@ @@ -383,18 +394,18 @@
// 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__15_0'
IL_0001: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_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__15_0'(object,
IL_000f: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<.ctor>b__18_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__15_0'
IL_001b: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents/'<>c'::'<>9__18_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()
@ -422,6 +433,10 @@ @@ -422,6 +433,10 @@
.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 NotAnAutoProperty()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents::get_NotAnAutoProperty()
} // end of property PropertiesAndEvents::NotAnAutoProperty
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.PropertiesAndEvents

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ShortCircuit.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly bqtfnoxz
.assembly ShortCircuit
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module bqtfnoxz.dll
// MVID: {E41D831E-089A-4F86-AA5D-FD2CB6D7C452}
.module ShortCircuit.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
// Image base: 0x03120000
// =============== CLASS MEMBERS DECLARATION ===================
@ -636,4 +632,3 @@ @@ -636,4 +632,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\ShortCircuit.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ShortCircuit.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '4yyrmwig'
.assembly ShortCircuit.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '4yyrmwig.dll'
// MVID: {A53FB590-72B6-46AB-809D-9F6F92B64475}
.module ShortCircuit.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
// Image base: 0x015D0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -464,4 +460,3 @@ @@ -464,4 +460,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\ShortCircuit.opt.res

31
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly eo05gpu0
.assembly Switch
{
.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module eo05gpu0.dll
// MVID: {9D56DD8F-56CC-4AA5-939D-F5DC041F1927}
.module Switch.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
// Image base: 0x04BA0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -880,7 +876,7 @@ @@ -880,7 +876,7 @@
IL_0015: brfalse IL_00e9
IL_001a: volatile.
IL_001c: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x600000d-1'
IL_001c: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_0021: brtrue.s IL_0084
IL_0023: ldc.i4.7
@ -921,9 +917,9 @@ @@ -921,9 +917,9 @@
IL_0078: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_007d: volatile.
IL_007f: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x600000d-1'
IL_007f: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_0084: volatile.
IL_0086: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x600000d-1'
IL_0086: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_008b: ldloc.1
IL_008c: ldloca.s V_2
IL_008e: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
@ -995,7 +991,7 @@ @@ -995,7 +991,7 @@
IL_0013: brfalse IL_0158
IL_0018: volatile.
IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x600000e-1'
IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000e-1'
IL_001f: brtrue IL_00b8
IL_0024: ldc.i4.s 11
@ -1056,9 +1052,9 @@ @@ -1056,9 +1052,9 @@
IL_00ac: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_00b1: volatile.
IL_00b3: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x600000e-1'
IL_00b3: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000e-1'
IL_00b8: volatile.
IL_00ba: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x600000e-1'
IL_00ba: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000e-1'
IL_00bf: ldloc.1
IL_00c0: ldloca.s V_2
IL_00c2: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
@ -1346,7 +1342,7 @@ @@ -1346,7 +1342,7 @@
IL_003b: brfalse IL_012c
IL_0040: volatile.
IL_0042: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x6000013-1'
IL_0042: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_0047: brtrue.s IL_009e
IL_0049: ldc.i4.6
@ -1382,9 +1378,9 @@ @@ -1382,9 +1378,9 @@
IL_0092: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0097: volatile.
IL_0099: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x6000013-1'
IL_0099: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_009e: volatile.
IL_00a0: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'::'$$method0x6000013-1'
IL_00a0: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_00a5: ldloc.s V_5
IL_00a7: ldloca.s V_6
IL_00a9: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
@ -1611,17 +1607,16 @@ @@ -1611,17 +1607,16 @@
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
.class private auto ansi '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'
.class private auto ansi '<PrivateImplementationDetails>'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x600000d-1'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x600000e-1'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x6000013-1'
} // end of class '<PrivateImplementationDetails>{9D56DD8F-56CC-4AA5-939D-F5DC041F1927}'
} // end of class '<PrivateImplementationDetails>'
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\Users\Siegfried\Projects\ILSpy master\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\Switch.res

31
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '1cqmq4ya'
.assembly Switch.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '1cqmq4ya.dll'
// MVID: {F6D6A0F8-249B-42E0-A06F-7A75134FD239}
.module Switch.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
// Image base: 0x05550000
// =============== CLASS MEMBERS DECLARATION ===================
@ -749,7 +745,7 @@ @@ -749,7 +745,7 @@
IL_0013: brfalse IL_00db
IL_0018: volatile.
IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x600000d-1'
IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_001f: brtrue.s IL_0082
IL_0021: ldc.i4.7
@ -790,9 +786,9 @@ @@ -790,9 +786,9 @@
IL_0076: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_007b: volatile.
IL_007d: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x600000d-1'
IL_007d: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_0082: volatile.
IL_0084: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x600000d-1'
IL_0084: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_0089: ldloc.0
IL_008a: ldloca.s V_1
IL_008c: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
@ -850,7 +846,7 @@ @@ -850,7 +846,7 @@
IL_0011: brfalse IL_013d
IL_0016: volatile.
IL_0018: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x600000e-1'
IL_0018: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000e-1'
IL_001d: brtrue IL_00b6
IL_0022: ldc.i4.s 11
@ -911,9 +907,9 @@ @@ -911,9 +907,9 @@
IL_00aa: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_00af: volatile.
IL_00b1: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x600000e-1'
IL_00b1: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000e-1'
IL_00b6: volatile.
IL_00b8: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x600000e-1'
IL_00b8: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x600000e-1'
IL_00bd: ldloc.0
IL_00be: ldloca.s V_1
IL_00c0: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
@ -1139,7 +1135,7 @@ @@ -1139,7 +1135,7 @@
IL_0037: brfalse IL_011f
IL_003c: volatile.
IL_003e: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x6000013-1'
IL_003e: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_0043: brtrue.s IL_009a
IL_0045: ldc.i4.6
@ -1175,9 +1171,9 @@ @@ -1175,9 +1171,9 @@
IL_008e: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0093: volatile.
IL_0095: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x6000013-1'
IL_0095: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_009a: volatile.
IL_009c: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'::'$$method0x6000013-1'
IL_009c: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_00a1: ldloc.s V_5
IL_00a3: ldloca.s V_6
IL_00a5: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
@ -1371,17 +1367,16 @@ @@ -1371,17 +1367,16 @@
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
.class private auto ansi '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'
.class private auto ansi '<PrivateImplementationDetails>'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x600000d-1'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x600000e-1'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x6000013-1'
} // end of class '<PrivateImplementationDetails>{F6D6A0F8-249B-42E0-A06F-7A75134FD239}'
} // end of class '<PrivateImplementationDetails>'
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\Users\Siegfried\Projects\ILSpy master\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\Switch.opt.res

100
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TupleTests.cs

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
// Copyright (c) 2018 Daniel Grunwald
//
// 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;
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class TupleTests
{
private abstract class OverloadResolution
{
public abstract void M1((long, long) a);
public abstract void M1(object a);
public void UseM1((int, int) a)
{
// M1(a); TODO: tuple conversion transform
// Cast is required to avoid the overload usable via tuple conversion:
M1((object)a);
}
}
public ValueTuple VT0;
public ValueTuple<int> VT1;
public ValueTuple<int, int, int, int, int, int, int, ValueTuple> VT7EmptyRest;
public (int, uint) Unnamed2;
public (int, int, int) Unnamed3;
public (int, int, int, int) Unnamed4;
public (int, int, int, int, int) Unnamed5;
public (int, int, int, int, int, int) Unnamed6;
public (int, int, int, int, int, int, int) Unnamed7;
public (int, int, int, int, int, int, int, int) Unnamed8;
public (int a, uint b) Named2;
public (int a, uint b)[] Named2Array;
public (int a, int b, int c, int d, int e, int f, int g, int h) Named8;
public (int, int a, int, int b, int) PartiallyNamed;
public ((int a, int b) x, (int, int) y, (int c, int d) z) Nested1;
public ((object a, dynamic b), dynamic, (dynamic c, object d)) Nested2;
public (ValueTuple a, (int x1, int x2), ValueTuple<int> b, (int y1, int y2), (int, int) c) Nested3;
public (int a, int b, int c, int d, int e, int f, int g, int h, (int i, int j)) Nested4;
public Dictionary<(int a, string b), (string c, int d)> TupleDict;
public int VT1Member => VT1.Item1;
public int AccessUnnamed8 => Unnamed8.Item8;
public int AccessNamed8 => Named8.h;
public int AccessPartiallyNamed => PartiallyNamed.a + PartiallyNamed.Item3;
public ValueTuple<int> NewTuple1 => new ValueTuple<int>(1);
public (int a, int b) NewTuple2 => (1, 2);
public object BoxedTuple10 => (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
public (uint, int) SwapUnnamed => (Unnamed2.Item2, Unnamed2.Item1);
public (uint, int) SwapNamed2 => (Named2.b, Named2.a);
public int TupleHash => (1, 2, 3).GetHashCode();
public int TupleHash2 => Named2.GetHashCode();
public (int, int) AccessRest => (1, 2, 3, 4, 5, 6, 7, 8, 9).Rest;
public (string, object, Action) TargetTyping => (null, 1, delegate {
});
public object NotTargetTyping => ((string)null, (object)1, (Action)delegate {
});
public void UseDict()
{
if (TupleDict.Count > 10) {
TupleDict.Clear();
}
// TODO: it would be nice if we could infer the name 'c' for the local
string item = TupleDict[(1, "abc")].c;
Console.WriteLine(item);
Console.WriteLine(item);
Console.WriteLine(TupleDict.Values.ToList().First().d);
}
}
}

519
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TupleTests.opt.roslyn.il

@ -0,0 +1,519 @@ @@ -0,0 +1,519 @@
// 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 extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly TupleTests
{
.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 TupleTests.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.TupleTests
extends [mscorlib]System.Object
{
.class abstract auto ansi nested private beforefieldinit OverloadResolution
extends [mscorlib]System.Object
{
.method public hidebysig newslot abstract virtual
instance void M1(valuetype [mscorlib]System.ValueTuple`2<int64,int64> a) cil managed
{
} // end of method OverloadResolution::M1
.method public hidebysig newslot abstract virtual
instance void M1(object a) cil managed
{
} // end of method OverloadResolution::M1
.method public hidebysig instance void
UseM1(valuetype [mscorlib]System.ValueTuple`2<int32,int32> a) cil managed
{
// Code size 13 (0xd)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: box valuetype [mscorlib]System.ValueTuple`2<int32,int32>
IL_0007: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/OverloadResolution::M1(object)
IL_000c: ret
} // end of method OverloadResolution::UseM1
.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 OverloadResolution::.ctor
} // end of class OverloadResolution
.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.TupleTests/'<>c' '<>9'
.field public static class [mscorlib]System.Action '<>9__45_0'
.field public static class [mscorlib]System.Action '<>9__47_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.TupleTests/'<>c'::.ctor()
IL_0005: stsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>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 void
'<get_TargetTyping>b__45_0'() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method '<>c'::'<get_TargetTyping>b__45_0'
.method assembly hidebysig instance void
'<get_NotTargetTyping>b__47_0'() cil managed
{
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method '<>c'::'<get_NotTargetTyping>b__47_0'
} // end of class '<>c'
.field public valuetype [mscorlib]System.ValueTuple VT0
.field public valuetype [mscorlib]System.ValueTuple`1<int32> VT1
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple> VT7EmptyRest
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Unnamed2
.field public valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> Unnamed3
.field public valuetype [mscorlib]System.ValueTuple`4<int32,int32,int32,int32> Unnamed4
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> Unnamed5
.field public valuetype [mscorlib]System.ValueTuple`6<int32,int32,int32,int32,int32,int32> Unnamed6
.field public valuetype [mscorlib]System.ValueTuple`7<int32,int32,int32,int32,int32,int32,int32> Unnamed7
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Unnamed8
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Named2
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32>[] Named2Array
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Named8
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e
01 66 01 67 01 68 FF 00 00 ) // .f.g.h...
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> PartiallyNamed
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 05 00 00 00 FF 01 61 FF 01 62 FF 00 00 ) // ........a..b...
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested1
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 78 01 79 01 7A 01 61 01 62 // .......x.y.z.a.b
FF FF 01 63 01 64 00 00 ) // ...c.d..
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<object,object>,object,valuetype [mscorlib]System.ValueTuple`2<object,object>> Nested2
.custom instance void [System.Core]System.Runtime.CompilerServices.DynamicAttribute::.ctor(bool[]) = ( 01 00 08 00 00 00 00 00 00 01 01 00 01 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 07 00 00 00 FF FF FF 01 61 01 62 01 63 01 // ..........a.b.c.
64 00 00 ) // d..
.field public valuetype [mscorlib]System.ValueTuple`5<valuetype [mscorlib]System.ValueTuple,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`1<int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested3
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0C 00 00 00 01 61 FF 01 62 FF 01 63 02 78 // .......a..b..c.x
31 02 78 32 FF 02 79 31 02 79 32 FF FF 00 00 ) // 1.x2..y1.y2....
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>> Nested4
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0D 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e
01 66 01 67 01 68 FF FF FF 01 69 01 6A 00 00 ) // .f.g.h....i.j..
.field public class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> TupleDict
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 04 00 00 00 01 61 01 62 01 63 01 64 00 00 ) // .......a.b.c.d..
.method public hidebysig specialname instance int32
get_VT1Member() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::VT1
IL_0006: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1
IL_000b: ret
} // end of method TupleTests::get_VT1Member
.method public hidebysig specialname instance int32
get_AccessUnnamed8() cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed8
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1
IL_0010: ret
} // end of method TupleTests::get_AccessUnnamed8
.method public hidebysig specialname instance int32
get_AccessNamed8() cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named8
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1
IL_0010: ret
} // end of method TupleTests::get_AccessNamed8
.method public hidebysig specialname instance int32
get_AccessPartiallyNamed() cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item2
IL_000b: ldarg.0
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed
IL_0011: ldfld !2 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item3
IL_0016: add
IL_0017: ret
} // end of method TupleTests::get_AccessPartiallyNamed
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`1<int32>
get_NewTuple1() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: newobj instance void valuetype [mscorlib]System.ValueTuple`1<int32>::.ctor(!0)
IL_0006: ret
} // end of method TupleTests::get_NewTuple1
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
get_NewTuple2() cil managed
{
.param [0]
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0,
!1)
IL_0007: ret
} // end of method TupleTests::get_NewTuple2
.method public hidebysig specialname instance object
get_BoxedTuple10() cil managed
{
// Code size 28 (0x1c)
.maxstack 10
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: ldc.i4.3
IL_0003: ldc.i4.4
IL_0004: ldc.i4.5
IL_0005: ldc.i4.6
IL_0006: ldc.i4.7
IL_0007: ldc.i4.8
IL_0008: ldc.i4.s 9
IL_000a: ldc.i4.s 10
IL_000c: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0,
!1,
!2)
IL_0011: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>>::.ctor(!0,
!1,
!2,
!3,
!4,
!5,
!6,
!7)
IL_0016: box valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>>
IL_001b: ret
} // end of method TupleTests::get_BoxedTuple10
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
get_SwapUnnamed() cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2
IL_000b: ldarg.0
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0,
!1)
IL_001b: ret
} // end of method TupleTests::get_SwapUnnamed
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
get_SwapNamed2() cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2
IL_000b: ldarg.0
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0,
!1)
IL_001b: ret
} // end of method TupleTests::get_SwapNamed2
.method public hidebysig specialname instance int32
get_TupleHash() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> V_0)
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: ldc.i4.3
IL_0003: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0,
!1,
!2)
IL_0008: stloc.0
IL_0009: ldloca.s V_0
IL_000b: constrained. valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>
IL_0011: callvirt instance int32 [mscorlib]System.Object::GetHashCode()
IL_0016: ret
} // end of method TupleTests::get_TupleHash
.method public hidebysig specialname instance int32
get_TupleHash2() cil managed
{
// Code size 18 (0x12)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2
IL_0006: constrained. valuetype [mscorlib]System.ValueTuple`2<int32,uint32>
IL_000c: callvirt instance int32 [mscorlib]System.Object::GetHashCode()
IL_0011: ret
} // end of method TupleTests::get_TupleHash2
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
get_AccessRest() cil managed
{
// Code size 26 (0x1a)
.maxstack 9
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: ldc.i4.3
IL_0003: ldc.i4.4
IL_0004: ldc.i4.5
IL_0005: ldc.i4.6
IL_0006: ldc.i4.7
IL_0007: ldc.i4.8
IL_0008: ldc.i4.s 9
IL_000a: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0,
!1)
IL_000f: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::.ctor(!0,
!1,
!2,
!3,
!4,
!5,
!6,
!7)
IL_0014: ldfld !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::Rest
IL_0019: ret
} // end of method TupleTests::get_AccessRest
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>
get_TargetTyping() cil managed
{
// Code size 44 (0x2c)
.maxstack 8
IL_0000: ldnull
IL_0001: ldc.i4.1
IL_0002: box [mscorlib]System.Int32
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0'
IL_000c: dup
IL_000d: brtrue.s IL_0026
IL_000f: pop
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9'
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_TargetTyping>b__45_0'()
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object,
native int)
IL_0020: dup
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0'
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0,
!1,
!2)
IL_002b: ret
} // end of method TupleTests::get_TargetTyping
.method public hidebysig specialname instance object
get_NotTargetTyping() cil managed
{
// Code size 49 (0x31)
.maxstack 8
IL_0000: ldnull
IL_0001: ldc.i4.1
IL_0002: box [mscorlib]System.Int32
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0'
IL_000c: dup
IL_000d: brtrue.s IL_0026
IL_000f: pop
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9'
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_NotTargetTyping>b__47_0'()
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object,
native int)
IL_0020: dup
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0'
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0,
!1,
!2)
IL_002b: box valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>
IL_0030: ret
} // end of method TupleTests::get_NotTargetTyping
.method public hidebysig instance void
UseDict() cil managed
{
// Code size 96 (0x60)
.maxstack 3
IL_0000: ldarg.0
IL_0001: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_0006: callvirt instance int32 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Count()
IL_000b: ldc.i4.s 10
IL_000d: ble.s IL_001a
IL_000f: ldarg.0
IL_0010: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_0015: callvirt instance void class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::Clear()
IL_001a: ldarg.0
IL_001b: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_0020: ldc.i4.1
IL_0021: ldstr "abc"
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,string>::.ctor(!0,
!1)
IL_002b: callvirt instance !1 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Item(!0)
IL_0030: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item1
IL_0035: dup
IL_0036: call void [mscorlib]System.Console::WriteLine(string)
IL_003b: call void [mscorlib]System.Console::WriteLine(string)
IL_0040: ldarg.0
IL_0041: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_0046: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/ValueCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Values()
IL_004b: call class [mscorlib]System.Collections.Generic.List`1<!!0> [System.Core]System.Linq.Enumerable::ToList<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_0050: call !!0 [System.Core]System.Linq.Enumerable::First<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_0055: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item2
IL_005a: call void [mscorlib]System.Console::WriteLine(int32)
IL_005f: ret
} // end of method TupleTests::UseDict
.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 TupleTests::.ctor
.property instance int32 VT1Member()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_VT1Member()
} // end of property TupleTests::VT1Member
.property instance int32 AccessUnnamed8()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessUnnamed8()
} // end of property TupleTests::AccessUnnamed8
.property instance int32 AccessNamed8()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessNamed8()
} // end of property TupleTests::AccessNamed8
.property instance int32 AccessPartiallyNamed()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessPartiallyNamed()
} // end of property TupleTests::AccessPartiallyNamed
.property instance valuetype [mscorlib]System.ValueTuple`1<int32>
NewTuple1()
{
.get instance valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple1()
} // end of property TupleTests::NewTuple1
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
NewTuple2()
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple2()
} // end of property TupleTests::NewTuple2
.property instance object BoxedTuple10()
{
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_BoxedTuple10()
} // end of property TupleTests::BoxedTuple10
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
SwapUnnamed()
{
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapUnnamed()
} // end of property TupleTests::SwapUnnamed
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
SwapNamed2()
{
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapNamed2()
} // end of property TupleTests::SwapNamed2
.property instance int32 TupleHash()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash()
} // end of property TupleTests::TupleHash
.property instance int32 TupleHash2()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash2()
} // end of property TupleTests::TupleHash2
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
AccessRest()
{
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessRest()
} // end of property TupleTests::AccessRest
.property instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>
TargetTyping()
{
.get instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TargetTyping()
} // end of property TupleTests::TargetTyping
.property instance object NotTargetTyping()
{
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NotTargetTyping()
} // end of property TupleTests::NotTargetTyping
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

540
ICSharpCode.Decompiler.Tests/TestCases/Pretty/TupleTests.roslyn.il

@ -0,0 +1,540 @@ @@ -0,0 +1,540 @@
// 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 extern System.Core
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly TupleTests
{
.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 TupleTests.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.TupleTests
extends [mscorlib]System.Object
{
.class abstract auto ansi nested private beforefieldinit OverloadResolution
extends [mscorlib]System.Object
{
.method public hidebysig newslot abstract virtual
instance void M1(valuetype [mscorlib]System.ValueTuple`2<int64,int64> a) cil managed
{
} // end of method OverloadResolution::M1
.method public hidebysig newslot abstract virtual
instance void M1(object a) cil managed
{
} // end of method OverloadResolution::M1
.method public hidebysig instance void
UseM1(valuetype [mscorlib]System.ValueTuple`2<int32,int32> a) cil managed
{
// Code size 15 (0xf)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldarg.1
IL_0003: box valuetype [mscorlib]System.ValueTuple`2<int32,int32>
IL_0008: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/OverloadResolution::M1(object)
IL_000d: nop
IL_000e: ret
} // end of method OverloadResolution::UseM1
.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 OverloadResolution::.ctor
} // end of class OverloadResolution
.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.TupleTests/'<>c' '<>9'
.field public static class [mscorlib]System.Action '<>9__45_0'
.field public static class [mscorlib]System.Action '<>9__47_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.TupleTests/'<>c'::.ctor()
IL_0005: stsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>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 void
'<get_TargetTyping>b__45_0'() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method '<>c'::'<get_TargetTyping>b__45_0'
.method assembly hidebysig instance void
'<get_NotTargetTyping>b__47_0'() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method '<>c'::'<get_NotTargetTyping>b__47_0'
} // end of class '<>c'
.field public valuetype [mscorlib]System.ValueTuple VT0
.field public valuetype [mscorlib]System.ValueTuple`1<int32> VT1
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple> VT7EmptyRest
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Unnamed2
.field public valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> Unnamed3
.field public valuetype [mscorlib]System.ValueTuple`4<int32,int32,int32,int32> Unnamed4
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> Unnamed5
.field public valuetype [mscorlib]System.ValueTuple`6<int32,int32,int32,int32,int32,int32> Unnamed6
.field public valuetype [mscorlib]System.ValueTuple`7<int32,int32,int32,int32,int32,int32,int32> Unnamed7
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Unnamed8
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32> Named2
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
.field public valuetype [mscorlib]System.ValueTuple`2<int32,uint32>[] Named2Array
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> Named8
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e
01 66 01 67 01 68 FF 00 00 ) // .f.g.h...
.field public valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> PartiallyNamed
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 05 00 00 00 FF 01 61 FF 01 62 FF 00 00 ) // ........a..b...
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested1
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 09 00 00 00 01 78 01 79 01 7A 01 61 01 62 // .......x.y.z.a.b
FF FF 01 63 01 64 00 00 ) // ...c.d..
.field public valuetype [mscorlib]System.ValueTuple`3<valuetype [mscorlib]System.ValueTuple`2<object,object>,object,valuetype [mscorlib]System.ValueTuple`2<object,object>> Nested2
.custom instance void [System.Core]System.Runtime.CompilerServices.DynamicAttribute::.ctor(bool[]) = ( 01 00 08 00 00 00 00 00 00 01 01 00 01 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 07 00 00 00 FF FF FF 01 61 01 62 01 63 01 // ..........a.b.c.
64 00 00 ) // d..
.field public valuetype [mscorlib]System.ValueTuple`5<valuetype [mscorlib]System.ValueTuple,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`1<int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>,valuetype [mscorlib]System.ValueTuple`2<int32,int32>> Nested3
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0C 00 00 00 01 61 FF 01 62 FF 01 63 02 78 // .......a..b..c.x
31 02 78 32 FF 02 79 31 02 79 32 FF FF 00 00 ) // 1.x2..y1.y2....
.field public valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>> Nested4
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 0D 00 00 00 01 61 01 62 01 63 01 64 01 65 // .......a.b.c.d.e
01 66 01 67 01 68 FF FF FF 01 69 01 6A 00 00 ) // .f.g.h....i.j..
.field public class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> TupleDict
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 04 00 00 00 01 61 01 62 01 63 01 64 00 00 ) // .......a.b.c.d..
.method public hidebysig specialname instance int32
get_VT1Member() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::VT1
IL_0006: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1
IL_000b: ret
} // end of method TupleTests::get_VT1Member
.method public hidebysig specialname instance int32
get_AccessUnnamed8() cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed8
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1
IL_0010: ret
} // end of method TupleTests::get_AccessUnnamed8
.method public hidebysig specialname instance int32
get_AccessNamed8() cil managed
{
// Code size 17 (0x11)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named8
IL_0006: ldflda !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`1<int32>>::Rest
IL_000b: ldfld !0 valuetype [mscorlib]System.ValueTuple`1<int32>::Item1
IL_0010: ret
} // end of method TupleTests::get_AccessNamed8
.method public hidebysig specialname instance int32
get_AccessPartiallyNamed() cil managed
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item2
IL_000b: ldarg.0
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::PartiallyNamed
IL_0011: ldfld !2 valuetype [mscorlib]System.ValueTuple`5<int32,int32,int32,int32,int32>::Item3
IL_0016: add
IL_0017: ret
} // end of method TupleTests::get_AccessPartiallyNamed
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`1<int32>
get_NewTuple1() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: newobj instance void valuetype [mscorlib]System.ValueTuple`1<int32>::.ctor(!0)
IL_0006: ret
} // end of method TupleTests::get_NewTuple1
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
get_NewTuple2() cil managed
{
.param [0]
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0,
!1)
IL_0007: ret
} // end of method TupleTests::get_NewTuple2
.method public hidebysig specialname instance object
get_BoxedTuple10() cil managed
{
// Code size 28 (0x1c)
.maxstack 10
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: ldc.i4.3
IL_0003: ldc.i4.4
IL_0004: ldc.i4.5
IL_0005: ldc.i4.6
IL_0006: ldc.i4.7
IL_0007: ldc.i4.8
IL_0008: ldc.i4.s 9
IL_000a: ldc.i4.s 10
IL_000c: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0,
!1,
!2)
IL_0011: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>>::.ctor(!0,
!1,
!2,
!3,
!4,
!5,
!6,
!7)
IL_0016: box valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>>
IL_001b: ret
} // end of method TupleTests::get_BoxedTuple10
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
get_SwapUnnamed() cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2
IL_000b: ldarg.0
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Unnamed2
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0,
!1)
IL_001b: ret
} // end of method TupleTests::get_SwapUnnamed
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
get_SwapNamed2() cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2
IL_0006: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item2
IL_000b: ldarg.0
IL_000c: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2
IL_0011: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<int32,uint32>::Item1
IL_0016: newobj instance void valuetype [mscorlib]System.ValueTuple`2<uint32,int32>::.ctor(!0,
!1)
IL_001b: ret
} // end of method TupleTests::get_SwapNamed2
.method public hidebysig specialname instance int32
get_TupleHash() cil managed
{
// Code size 23 (0x17)
.maxstack 3
.locals init (valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32> V_0)
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: ldc.i4.3
IL_0003: newobj instance void valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>::.ctor(!0,
!1,
!2)
IL_0008: stloc.0
IL_0009: ldloca.s V_0
IL_000b: constrained. valuetype [mscorlib]System.ValueTuple`3<int32,int32,int32>
IL_0011: callvirt instance int32 [mscorlib]System.Object::GetHashCode()
IL_0016: ret
} // end of method TupleTests::get_TupleHash
.method public hidebysig specialname instance int32
get_TupleHash2() cil managed
{
// Code size 18 (0x12)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldflda valuetype [mscorlib]System.ValueTuple`2<int32,uint32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::Named2
IL_0006: constrained. valuetype [mscorlib]System.ValueTuple`2<int32,uint32>
IL_000c: callvirt instance int32 [mscorlib]System.Object::GetHashCode()
IL_0011: ret
} // end of method TupleTests::get_TupleHash2
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
get_AccessRest() cil managed
{
// Code size 26 (0x1a)
.maxstack 9
IL_0000: ldc.i4.1
IL_0001: ldc.i4.2
IL_0002: ldc.i4.3
IL_0003: ldc.i4.4
IL_0004: ldc.i4.5
IL_0005: ldc.i4.6
IL_0006: ldc.i4.7
IL_0007: ldc.i4.8
IL_0008: ldc.i4.s 9
IL_000a: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,int32>::.ctor(!0,
!1)
IL_000f: newobj instance void valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::.ctor(!0,
!1,
!2,
!3,
!4,
!5,
!6,
!7)
IL_0014: ldfld !7 valuetype [mscorlib]System.ValueTuple`8<int32,int32,int32,int32,int32,int32,int32,valuetype [mscorlib]System.ValueTuple`2<int32,int32>>::Rest
IL_0019: ret
} // end of method TupleTests::get_AccessRest
.method public hidebysig specialname instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>
get_TargetTyping() cil managed
{
// Code size 44 (0x2c)
.maxstack 8
IL_0000: ldnull
IL_0001: ldc.i4.1
IL_0002: box [mscorlib]System.Int32
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0'
IL_000c: dup
IL_000d: brtrue.s IL_0026
IL_000f: pop
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9'
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_TargetTyping>b__45_0'()
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object,
native int)
IL_0020: dup
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__45_0'
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0,
!1,
!2)
IL_002b: ret
} // end of method TupleTests::get_TargetTyping
.method public hidebysig specialname instance object
get_NotTargetTyping() cil managed
{
// Code size 49 (0x31)
.maxstack 8
IL_0000: ldnull
IL_0001: ldc.i4.1
IL_0002: box [mscorlib]System.Int32
IL_0007: ldsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0'
IL_000c: dup
IL_000d: brtrue.s IL_0026
IL_000f: pop
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9'
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<get_NotTargetTyping>b__47_0'()
IL_001b: newobj instance void [mscorlib]System.Action::.ctor(object,
native int)
IL_0020: dup
IL_0021: stsfld class [mscorlib]System.Action ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests/'<>c'::'<>9__47_0'
IL_0026: newobj instance void valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>::.ctor(!0,
!1,
!2)
IL_002b: box valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>
IL_0030: ret
} // end of method TupleTests::get_NotTargetTyping
.method public hidebysig instance void
UseDict() cil managed
{
// Code size 109 (0x6d)
.maxstack 3
.locals init (string V_0,
bool V_1)
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_0007: callvirt instance int32 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Count()
IL_000c: ldc.i4.s 10
IL_000e: cgt
IL_0010: stloc.1
IL_0011: ldloc.1
IL_0012: brfalse.s IL_0022
IL_0014: nop
IL_0015: ldarg.0
IL_0016: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_001b: callvirt instance void class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::Clear()
IL_0020: nop
IL_0021: nop
IL_0022: ldarg.0
IL_0023: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_0028: ldc.i4.1
IL_0029: ldstr "abc"
IL_002e: newobj instance void valuetype [mscorlib]System.ValueTuple`2<int32,string>::.ctor(!0,
!1)
IL_0033: callvirt instance !1 class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Item(!0)
IL_0038: ldfld !0 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item1
IL_003d: stloc.0
IL_003e: ldloc.0
IL_003f: call void [mscorlib]System.Console::WriteLine(string)
IL_0044: nop
IL_0045: ldloc.0
IL_0046: call void [mscorlib]System.Console::WriteLine(string)
IL_004b: nop
IL_004c: ldarg.0
IL_004d: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::TupleDict
IL_0052: callvirt instance class [mscorlib]System.Collections.Generic.Dictionary`2/ValueCollection<!0,!1> class [mscorlib]System.Collections.Generic.Dictionary`2<valuetype [mscorlib]System.ValueTuple`2<int32,string>,valuetype [mscorlib]System.ValueTuple`2<string,int32>>::get_Values()
IL_0057: call class [mscorlib]System.Collections.Generic.List`1<!!0> [System.Core]System.Linq.Enumerable::ToList<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_005c: call !!0 [System.Core]System.Linq.Enumerable::First<valuetype [mscorlib]System.ValueTuple`2<string,int32>>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
IL_0061: ldfld !1 valuetype [mscorlib]System.ValueTuple`2<string,int32>::Item2
IL_0066: call void [mscorlib]System.Console::WriteLine(int32)
IL_006b: nop
IL_006c: ret
} // end of method TupleTests::UseDict
.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 TupleTests::.ctor
.property instance int32 VT1Member()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_VT1Member()
} // end of property TupleTests::VT1Member
.property instance int32 AccessUnnamed8()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessUnnamed8()
} // end of property TupleTests::AccessUnnamed8
.property instance int32 AccessNamed8()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessNamed8()
} // end of property TupleTests::AccessNamed8
.property instance int32 AccessPartiallyNamed()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessPartiallyNamed()
} // end of property TupleTests::AccessPartiallyNamed
.property instance valuetype [mscorlib]System.ValueTuple`1<int32>
NewTuple1()
{
.get instance valuetype [mscorlib]System.ValueTuple`1<int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple1()
} // end of property TupleTests::NewTuple1
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
NewTuple2()
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.TupleElementNamesAttribute::.ctor(string[]) = ( 01 00 02 00 00 00 01 61 01 62 00 00 ) // .......a.b..
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NewTuple2()
} // end of property TupleTests::NewTuple2
.property instance object BoxedTuple10()
{
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_BoxedTuple10()
} // end of property TupleTests::BoxedTuple10
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
SwapUnnamed()
{
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapUnnamed()
} // end of property TupleTests::SwapUnnamed
.property instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32>
SwapNamed2()
{
.get instance valuetype [mscorlib]System.ValueTuple`2<uint32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_SwapNamed2()
} // end of property TupleTests::SwapNamed2
.property instance int32 TupleHash()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash()
} // end of property TupleTests::TupleHash
.property instance int32 TupleHash2()
{
.get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TupleHash2()
} // end of property TupleTests::TupleHash2
.property instance valuetype [mscorlib]System.ValueTuple`2<int32,int32>
AccessRest()
{
.get instance valuetype [mscorlib]System.ValueTuple`2<int32,int32> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_AccessRest()
} // end of property TupleTests::AccessRest
.property instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action>
TargetTyping()
{
.get instance valuetype [mscorlib]System.ValueTuple`3<string,object,class [mscorlib]System.Action> ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_TargetTyping()
} // end of property TupleTests::TargetTyping
.property instance object NotTargetTyping()
{
.get instance object ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests::get_NotTargetTyping()
} // end of property TupleTests::NotTargetTyping
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.TupleTests
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

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

@ -244,5 +244,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -244,5 +244,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
return string.Equals("", "", b ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
}
public bool MethodCallOnEnumConstant()
{
return AttributeTargets.All.HasFlag(AttributeTargets.Assembly);
}
}
}

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly mu5mxl5m
.assembly TypeAnalysisTests
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module mu5mxl5m.dll
// MVID: {DBFE6CB1-ED58-473D-986E-A633C15C8AEE}
.module TypeAnalysisTests.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
// Image base: 0x04E10000
// =============== CLASS MEMBERS DECLARATION ===================
@ -848,6 +844,25 @@ @@ -848,6 +844,25 @@
IL_001c: ret
} // end of method TypeAnalysisTests::EnumInConditionalOperator
.method public hidebysig instance bool
MethodCallOnEnumConstant() cil managed
{
// Code size 27 (0x1b)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldc.i4 0x7fff
IL_0006: box [mscorlib]System.AttributeTargets
IL_000b: ldc.i4.1
IL_000c: box [mscorlib]System.AttributeTargets
IL_0011: call instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0016: stloc.0
IL_0017: br.s IL_0019
IL_0019: ldloc.0
IL_001a: ret
} // end of method TypeAnalysisTests::MethodCallOnEnumConstant
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -864,4 +879,3 @@ @@ -864,4 +879,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\TypeAnalysisTests.res

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly tbojr2zd
.assembly TypeAnalysisTests.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module tbojr2zd.dll
// MVID: {A417EC21-8726-4629-9E82-47FE9895CD81}
.module TypeAnalysisTests.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
// Image base: 0x05150000
// =============== CLASS MEMBERS DECLARATION ===================
@ -586,6 +582,19 @@ @@ -586,6 +582,19 @@
IL_0016: ret
} // end of method TypeAnalysisTests::EnumInConditionalOperator
.method public hidebysig instance bool
MethodCallOnEnumConstant() cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: ldc.i4 0x7fff
IL_0005: box [mscorlib]System.AttributeTargets
IL_000a: ldc.i4.1
IL_000b: box [mscorlib]System.AttributeTargets
IL_0010: call instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0015: ret
} // end of method TypeAnalysisTests::MethodCallOnEnumConstant
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
@ -602,4 +611,3 @@ @@ -602,4 +611,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\TypeAnalysisTests.opt.res

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

@ -584,6 +584,19 @@ @@ -584,6 +584,19 @@
IL_0016: ret
} // end of method TypeAnalysisTests::EnumInConditionalOperator
.method public hidebysig instance bool
MethodCallOnEnumConstant() cil managed
{
// Code size 22 (0x16)
.maxstack 8
IL_0000: ldc.i4 0x7fff
IL_0005: box [mscorlib]System.AttributeTargets
IL_000a: ldc.i4.1
IL_000b: box [mscorlib]System.AttributeTargets
IL_0010: call instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0015: ret
} // end of method TypeAnalysisTests::MethodCallOnEnumConstant
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

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

@ -842,6 +842,25 @@ @@ -842,6 +842,25 @@
IL_001b: ret
} // end of method TypeAnalysisTests::EnumInConditionalOperator
.method public hidebysig instance bool
MethodCallOnEnumConstant() cil managed
{
// Code size 27 (0x1b)
.maxstack 2
.locals init (bool V_0)
IL_0000: nop
IL_0001: ldc.i4 0x7fff
IL_0006: box [mscorlib]System.AttributeTargets
IL_000b: ldc.i4.1
IL_000c: box [mscorlib]System.AttributeTargets
IL_0011: call instance bool [mscorlib]System.Enum::HasFlag(class [mscorlib]System.Enum)
IL_0016: stloc.0
IL_0017: br.s IL_0019
IL_0019: ldloc.0
IL_001a: ret
} // end of method TypeAnalysisTests::MethodCallOnEnumConstant
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly wbbysi3m
.assembly UnsafeCode
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module wbbysi3m.dll
// MVID: {8A733FFA-BF2C-4A07-BAE8-CC2DB20691C0}
.module UnsafeCode.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
// Image base: 0x04D30000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1445,4 +1441,3 @@ @@ -1445,4 +1441,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\work\ILSpy\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\UnsafeCode.res

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

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly apfrp3oh
.assembly UnsafeCode.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module apfrp3oh.dll
// MVID: {18CFEE2F-79CA-4464-BA60-BA8E54BE2D99}
.module UnsafeCode.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
// Image base: 0x04CA0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1165,4 +1161,3 @@ @@ -1165,4 +1161,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\work\ILSpy\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\UnsafeCode.opt.res

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

@ -841,31 +841,29 @@ @@ -841,31 +841,29 @@
FixedMemberAccess(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers* m,
int32 i) cil managed
{
// Code size 39 (0x27)
// Code size 37 (0x25)
.maxstack 8
IL_0000: ldarg.1
IL_0001: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Integers
IL_0006: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer'::FixedElementField
IL_000b: conv.u
IL_000c: ldarg.2
IL_000d: conv.i
IL_000e: ldc.i4.4
IL_000f: mul
IL_0010: add
IL_0011: ldind.i4
IL_0012: conv.r8
IL_0013: ldarg.1
IL_0014: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Doubles
IL_0019: ldflda float64 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer'::FixedElementField
IL_001e: conv.u
IL_001f: ldarg.2
IL_0020: conv.i
IL_0021: ldc.i4.8
IL_0022: mul
IL_000b: ldarg.2
IL_000c: conv.i
IL_000d: ldc.i4.4
IL_000e: mul
IL_000f: add
IL_0010: ldind.i4
IL_0011: conv.r8
IL_0012: ldarg.1
IL_0013: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Doubles
IL_0018: ldflda float64 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer'::FixedElementField
IL_001d: ldarg.2
IL_001e: conv.i
IL_001f: ldc.i4.8
IL_0020: mul
IL_0021: add
IL_0022: ldind.r8
IL_0023: add
IL_0024: ldind.r8
IL_0025: add
IL_0026: ret
IL_0024: ret
} // end of method UnsafeCode::FixedMemberAccess
.method public hidebysig instance float64*
@ -898,7 +896,7 @@ @@ -898,7 +896,7 @@
.method public hidebysig instance void
UseFixedMemberAsReference(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers* m) cil managed
{
// Code size 39 (0x27)
// Code size 38 (0x26)
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldarg.1
@ -910,11 +908,10 @@ @@ -910,11 +908,10 @@
IL_0013: ldarg.1
IL_0014: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Integers
IL_0019: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer'::FixedElementField
IL_001e: conv.u
IL_001f: ldc.i4.4
IL_0020: add
IL_0021: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::UseReference(int32&)
IL_0026: ret
IL_001e: ldc.i4.4
IL_001f: add
IL_0020: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::UseReference(int32&)
IL_0025: ret
} // end of method UnsafeCode::UseFixedMemberAsReference
.method public hidebysig instance void
@ -923,7 +920,7 @@ @@ -923,7 +920,7 @@
// Code size 27 (0x1b)
.maxstack 2
.locals init (int32* V_0,
int32*& pinned V_1)
int32& pinned V_1)
IL_0000: ldarg.1
IL_0001: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Integers
IL_0006: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer'::FixedElementField

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

@ -1053,37 +1053,35 @@ @@ -1053,37 +1053,35 @@
FixedMemberAccess(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers* m,
int32 i) cil managed
{
// Code size 44 (0x2c)
// Code size 42 (0x2a)
.maxstack 4
.locals init (float64 V_0)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Integers
IL_0007: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer'::FixedElementField
IL_000c: conv.u
IL_000d: ldarg.2
IL_000e: conv.i
IL_000f: ldc.i4.4
IL_0010: mul
IL_0011: add
IL_0012: ldind.i4
IL_0013: conv.r8
IL_0014: ldarg.1
IL_0015: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Doubles
IL_001a: ldflda float64 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer'::FixedElementField
IL_001f: conv.u
IL_0020: ldarg.2
IL_0021: conv.i
IL_0022: ldc.i4.8
IL_0023: mul
IL_000c: ldarg.2
IL_000d: conv.i
IL_000e: ldc.i4.4
IL_000f: mul
IL_0010: add
IL_0011: ldind.i4
IL_0012: conv.r8
IL_0013: ldarg.1
IL_0014: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Doubles
IL_0019: ldflda float64 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Doubles>e__FixedBuffer'::FixedElementField
IL_001e: ldarg.2
IL_001f: conv.i
IL_0020: ldc.i4.8
IL_0021: mul
IL_0022: add
IL_0023: ldind.r8
IL_0024: add
IL_0025: ldind.r8
IL_0026: add
IL_0027: stloc.0
IL_0028: br.s IL_002a
IL_0025: stloc.0
IL_0026: br.s IL_0028
IL_002a: ldloc.0
IL_002b: ret
IL_0028: ldloc.0
IL_0029: ret
} // end of method UnsafeCode::FixedMemberAccess
.method public hidebysig instance float64*
@ -1123,7 +1121,7 @@ @@ -1123,7 +1121,7 @@
.method public hidebysig instance void
UseFixedMemberAsReference(valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers* m) cil managed
{
// Code size 42 (0x2a)
// Code size 41 (0x29)
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
@ -1137,12 +1135,11 @@ @@ -1137,12 +1135,11 @@
IL_0015: ldarg.1
IL_0016: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Integers
IL_001b: ldflda int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer'::FixedElementField
IL_0020: conv.u
IL_0021: ldc.i4.4
IL_0022: add
IL_0023: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::UseReference(int32&)
IL_0028: nop
IL_0029: ret
IL_0020: ldc.i4.4
IL_0021: add
IL_0022: call instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode::UseReference(int32&)
IL_0027: nop
IL_0028: ret
} // end of method UnsafeCode::UseFixedMemberAsReference
.method public hidebysig instance void
@ -1151,7 +1148,7 @@ @@ -1151,7 +1148,7 @@
// Code size 30 (0x1e)
.maxstack 2
.locals init (int32* V_0,
int32*& pinned V_1)
int32& pinned V_1)
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldflda valuetype ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers/'<Integers>e__FixedBuffer' ICSharpCode.Decompiler.Tests.TestCases.Pretty.UnsafeCode/StructWithFixedSizeMembers::Integers

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly wgewqkaz
.assembly Using
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module wgewqkaz.dll
// MVID: {298A3373-9EF1-4D76-BCEC-2E82A945AF55}
.module Using.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
// Image base: 0x00550000
// =============== CLASS MEMBERS DECLARATION ===================
@ -519,4 +515,3 @@ @@ -519,4 +515,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Using.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Using.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly ms0npdxf
.assembly Using.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ms0npdxf.dll
// MVID: {060FC94F-8DAE-4720-AF67-48BEEC70FFC8}
.module Using.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
// Image base: 0x030B0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -408,4 +404,3 @@ @@ -408,4 +404,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Using.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly sw5i42xa
.assembly VariableNaming
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module sw5i42xa.dll
// MVID: {863C0756-F3DB-4C0E-BC40-5DDA3E7F1B18}
.module VariableNaming.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
// Image base: 0x02C40000
// =============== CLASS MEMBERS DECLARATION ===================
@ -97,4 +93,3 @@ @@ -97,4 +93,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\VariableNaming.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly kt4vyfax
.assembly VariableNaming.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module kt4vyfax.dll
// MVID: {2FDC68D5-1FEC-45A6-BADC-43373DBD141E}
.module VariableNaming.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
// Image base: 0x05090000
// =============== CLASS MEMBERS DECLARATION ===================
@ -93,4 +89,3 @@ @@ -93,4 +89,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\VariableNaming.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly guxeth2f
.assembly VariableNamingWithoutSymbols
{
.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module guxeth2f.dll
// MVID: {D7E12634-3178-4FDA-B3F4-CE4846CACB94}
.module VariableNamingWithoutSymbols.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
// Image base: 0x04ED0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -97,4 +93,3 @@ @@ -97,4 +93,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\VariableNamingWithoutSymbols.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly wl1juwwv
.assembly VariableNamingWithoutSymbols.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
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module wl1juwwv.dll
// MVID: {F60C4045-F949-4857-AE4D-AD0ED806A44F}
.module VariableNamingWithoutSymbols.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
// Image base: 0x03250000
// =============== CLASS MEMBERS DECLARATION ===================
@ -93,4 +89,3 @@ @@ -93,4 +89,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\VariableNamingWithoutSymbols.opt.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '44dbunlx'
.assembly WellKnownConstants
{
.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '44dbunlx.dll'
// MVID: {084D6FE7-6C94-46BC-9CF1-21040E4EE5EA}
.module WellKnownConstants.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
// Image base: 0x03200000
// =============== CLASS MEMBERS DECLARATION ===================
@ -128,4 +124,3 @@ @@ -128,4 +124,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\Users\Siegfried\Projects\ILSpy master\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\WellKnownConstants.res

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.opt.il

@ -1,6 +1,4 @@ @@ -1,6 +1,4 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +8,7 @@ @@ -10,7 +8,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly '2a1zmun4'
.assembly WellKnownConstants.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.
@ -20,15 +18,13 @@ @@ -20,15 +18,13 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module '2a1zmun4.dll'
// MVID: {68191A55-6426-48F1-B0FE-6B515D64B18A}
.module WellKnownConstants.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
// Image base: 0x03170000
// =============== CLASS MEMBERS DECLARATION ===================
@ -128,4 +124,3 @@ @@ -128,4 +124,3 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// WARNING: Created Win32 resource file C:\Users\Siegfried\Projects\ILSpy master\ICSharpCode.Decompiler.Tests\bin\Debug\net46\../../../TestCases/Pretty\WellKnownConstants.opt.res

21
ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemHelper.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
namespace ICSharpCode.Decompiler.Tests.TypeSystem
{
public static class TypeSystemHelper
{
public static ICompilation CreateCompilation(params IUnresolvedTypeDefinition[] unresolvedTypeDefinitions)
{
var unresolvedAsm = new DefaultUnresolvedAssembly("dummy");
foreach (var typeDef in unresolvedTypeDefinitions)
unresolvedAsm.AddTypeDefinition(typeDef);
return new SimpleCompilation(unresolvedAsm, TypeSystemLoaderTests.Mscorlib, TypeSystemLoaderTests.SystemCore);
}
}
}

9
ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs

@ -42,16 +42,21 @@ namespace ICSharpCode.Decompiler.Tests.TypeSystem @@ -42,16 +42,21 @@ namespace ICSharpCode.Decompiler.Tests.TypeSystem
return new CecilLoader().LoadAssemblyFile(typeof(System.Linq.Enumerable).Assembly.Location);
});
static readonly Lazy<IUnresolvedAssembly> testAssembly = new Lazy<IUnresolvedAssembly>(
delegate {
return new CecilLoader { IncludeInternalMembers = true }.LoadAssemblyFile(typeof(SimplePublicClass).Assembly.Location);
});
public static IUnresolvedAssembly Mscorlib { get { return mscorlib.Value; } }
public static IUnresolvedAssembly SystemCore { get { return systemCore.Value; } }
public static IUnresolvedAssembly TestAssembly { get { return testAssembly.Value; } }
[OneTimeSetUp]
public void FixtureSetUp()
{
// use "IncludeInternalMembers" so that Cecil results match C# parser results
CecilLoader loader = new CecilLoader() { IncludeInternalMembers = true };
IUnresolvedAssembly asm = loader.LoadAssemblyFile(typeof(SimplePublicClass).Assembly.Location);
compilation = new SimpleCompilation(asm, Mscorlib);
compilation = new SimpleCompilation(TestAssembly, Mscorlib);
}
protected ICompilation compilation;

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

Loading…
Cancel
Save