Browse Source

Merge branch 'master' of https://github.com/icsharpcode/ILSpy into combine-exitpoints-in-lambdas

pull/1405/head
Siegfried Pammer 7 years ago
parent
commit
abff91f0c2
  1. 2
      DecompilerNuGetDemos.workbook
  2. 8
      ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj
  3. 2
      ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj
  4. 1
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  5. 6
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  6. 35
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.cs
  7. 88
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.il
  8. 120
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.mcs.il
  9. 87
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.opt.il
  10. 120
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.opt.mcs.il
  11. 91
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.opt.roslyn.il
  12. 93
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.roslyn.il
  13. 108
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs
  14. 399
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.il
  15. 430
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.il
  16. 418
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.roslyn.il
  17. 446
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.roslyn.il
  18. 49
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs
  19. 121
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il
  20. 92
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.mcs.il
  21. 88
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il
  22. 92
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.mcs.il
  23. 85
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il
  24. 122
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il
  25. 10
      ICSharpCode.Decompiler.Tests/TypeSystem/TypeSystemLoaderTests.cs
  26. 4
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  27. 42
      ICSharpCode.Decompiler/CSharp/CallBuilder.cs
  28. 10
      ICSharpCode.Decompiler/CSharp/StatementBuilder.cs
  29. 8
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
  30. 15
      ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs
  31. 5
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUnsafeModifier.cs
  32. 2
      ICSharpCode.Decompiler/IL/ControlFlow/YieldReturnDecompiler.cs
  33. 2
      ICSharpCode.Decompiler/IL/Transforms/CachedDelegateInitialization.cs
  34. 8
      ICSharpCode.Decompiler/IL/Transforms/HighLevelLoopTransform.cs
  35. 11
      ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs
  36. 2
      ICSharpCode.Decompiler/IL/Transforms/NamedArgumentTransform.cs
  37. 13
      ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs
  38. 4
      ICSharpCode.Decompiler/TypeSystem/DecompilerTypeSystem.cs
  39. 2
      ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs
  40. 3
      ILSpy.AddIn/Commands/OpenCodeItemCommand.cs
  41. 9
      ILSpy.AddIn/Commands/OpenILSpyCommand.cs
  42. 3
      ILSpy.AddIn/Commands/OpenProjectOutputCommand.cs
  43. 3
      ILSpy.AddIn/Commands/OpenReferenceCommand.cs
  44. 41
      ILSpy.AddIn/ILSpy.AddIn.csproj
  45. 36
      ILSpy.AddIn/ILSpyAddInPackage.cs
  46. 10
      ILSpy.AddIn/ILSpyInstance.cs
  47. 4
      ILSpy.AddIn/source.extension.vsixmanifest.template
  48. 14
      ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj
  49. 5
      ILSpy.sln
  50. 2
      ILSpy/FilterSettings.cs
  51. 47
      ILSpy/ILSpy.csproj
  52. 11
      ILSpy/MainWindow.xaml.cs
  53. 95
      ILSpy/NativeMethods.cs
  54. 4
      ILSpy/Properties/AssemblyInfo.template.cs
  55. 2
      ILSpy/Search/SearchPane.cs
  56. 12
      ILSpy/TreeNodes/TypeTreeNode.cs
  57. 10
      SharpTreeView/ICSharpCode.TreeView.csproj
  58. 10
      TestPlugin/TestPlugin.csproj
  59. 5
      global.json

2
DecompilerNuGetDemos.workbook

@ -6,7 +6,7 @@ platforms:
- DotNetCore - DotNetCore
packages: packages:
- id: ICSharpCode.Decompiler - id: ICSharpCode.Decompiler
version: 4.0.0.4509-rc1 version: 4.0.0.4521
--- ---
Setup: load the references required to work with the decompiler Setup: load the references required to work with the decompiler

8
ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj

@ -7,7 +7,7 @@
<PackAsTool>true</PackAsTool> <PackAsTool>true</PackAsTool>
<AssemblyName>ilspycmd</AssemblyName> <AssemblyName>ilspycmd</AssemblyName>
<ToolCommandName>ilspycmd</ToolCommandName> <ToolCommandName>ilspycmd</ToolCommandName>
<Version>3.8.0</Version> <Version>4.0</Version>
<Description>Command-line decompiler using the ILSpy decompilation engine</Description> <Description>Command-line decompiler using the ILSpy decompilation engine</Description>
<Copyright>Copyright 2011-2019 AlphaSierraPapa</Copyright> <Copyright>Copyright 2011-2019 AlphaSierraPapa</Copyright>
<PackageProjectUrl>https://github.com/icsharpcode/ILSpy/</PackageProjectUrl> <PackageProjectUrl>https://github.com/icsharpcode/ILSpy/</PackageProjectUrl>
@ -15,8 +15,8 @@
<PackageIconUrl>https://ilspy.net/images/icon32.png</PackageIconUrl> <PackageIconUrl>https://ilspy.net/images/icon32.png</PackageIconUrl>
<RepositoryUrl>https://github.com/icsharpcode/ILSpy/</RepositoryUrl> <RepositoryUrl>https://github.com/icsharpcode/ILSpy/</RepositoryUrl>
<Company /> <Company />
<AssemblyVersion>3.8.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>3.8.0.0</FileVersion> <FileVersion>4.0.0.0</FileVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
@ -27,7 +27,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.5" /> <PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.5" />
<PackageReference Include="ICSharpCode.Decompiler" Version="4.0.0.4509-rc1" /> <PackageReference Include="ICSharpCode.Decompiler" Version="4.0.0.4521" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" /> <PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" /> <PackageReference Include="System.Runtime.Handles" Version="4.3.0" />

2
ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj

@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0" /> <PackageReference Include="PowerShellStandard.Library" Version="5.1.0" />
<PackageReference Include="ICSharpCode.Decompiler" Version="4.0.0.4509-rc1" /> <PackageReference Include="ICSharpCode.Decompiler" Version="4.0.0.4521" />
</ItemGroup> </ItemGroup>
</Project> </Project>

1
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -73,6 +73,7 @@
<Compile Include="TestCases\Correctness\RefLocalsAndReturns.cs" /> <Compile Include="TestCases\Correctness\RefLocalsAndReturns.cs" />
<Compile Include="TestCases\ILPretty\Issue1256.cs" /> <Compile Include="TestCases\ILPretty\Issue1256.cs" />
<Compile Include="TestCases\ILPretty\Issue1323.cs" /> <Compile Include="TestCases\ILPretty\Issue1323.cs" />
<Compile Include="TestCases\Pretty\ConstructorInitializers.cs" />
<None Include="TestCases\Pretty\AsyncMain.cs" /> <None Include="TestCases\Pretty\AsyncMain.cs" />
<None Include="TestCases\ILPretty\Issue1325.cs" /> <None Include="TestCases\ILPretty\Issue1325.cs" />
<Compile Include="TestCases\Pretty\ConstantsTests.cs" /> <Compile Include="TestCases\Pretty\ConstantsTests.cs" />

6
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -220,6 +220,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions); RunForLibrary(cscOptions: cscOptions);
} }
[Test]
public void ConstructorInitializers([ValueSource(nameof(defaultOptionsWithMcs))] CSharpCompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}
[Test] [Test]
public void PInvoke([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions) public void PInvoke([ValueSource(nameof(defaultOptions))] CSharpCompilerOptions cscOptions)
{ {

35
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.cs

@ -0,0 +1,35 @@
// 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.
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
public class ConstructorInitializers
{
public struct SimpleStruct
{
public int Field1;
public int Field2;
}
public class UnsafeFields
{
public unsafe static int StaticSizeOf = sizeof(SimpleStruct);
public unsafe int SizeOf = sizeof(SimpleStruct);
}
}
}

88
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.il

@ -0,0 +1,88 @@
// 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 ConstructorInitializers
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ConstructorInitializers.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.ConstructorInitializers
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit SimpleStruct
extends [mscorlib]System.ValueType
{
.field public int32 Field1
.field public int32 Field2
} // end of class SimpleStruct
.class auto ansi nested public beforefieldinit UnsafeFields
extends [mscorlib]System.Object
{
.field public static int32 StaticSizeOf
.field public int32 SizeOf
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::SizeOf
IL_000c: ldarg.0
IL_000d: call instance void [mscorlib]System.Object::.ctor()
IL_0012: nop
IL_0013: ret
} // end of method UnsafeFields::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0006: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::StaticSizeOf
IL_000b: ret
} // end of method UnsafeFields::.cctor
} // end of class UnsafeFields
.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 ConstructorInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

120
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.mcs.il

@ -0,0 +1,120 @@
// Metadata version: v2.0.50727
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly ConstructorInitializers.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.
.permissionset reqmin
bytearray (3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // <.P.e.r.m.i.s.s.
69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00 // i.o.n.S.e.t. .c.
6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00 // l.a.s.s.=.".S.y.
73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00 // s.t.e.m...S.e.c.
75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00 // u.r.i.t.y...P.e.
72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
53 00 65 00 74 00 22 00 0D 00 0A 00 76 00 65 00 // S.e.t.".....v.e.
72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 // r.s.i.o.n.=.".1.
22 00 3E 00 0D 00 0A 00 3C 00 49 00 50 00 65 00 // ".>.....<.I.P.e.
72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
20 00 63 00 6C 00 61 00 73 00 73 00 3D 00 22 00 // .c.l.a.s.s.=.".
53 00 79 00 73 00 74 00 65 00 6D 00 2E 00 53 00 // S.y.s.t.e.m...S.
65 00 63 00 75 00 72 00 69 00 74 00 79 00 2E 00 // e.c.u.r.i.t.y...
50 00 65 00 72 00 6D 00 69 00 73 00 73 00 69 00 // P.e.r.m.i.s.s.i.
6F 00 6E 00 73 00 2E 00 53 00 65 00 63 00 75 00 // o.n.s...S.e.c.u.
72 00 69 00 74 00 79 00 50 00 65 00 72 00 6D 00 // r.i.t.y.P.e.r.m.
69 00 73 00 73 00 69 00 6F 00 6E 00 2C 00 20 00 // i.s.s.i.o.n.,. .
6D 00 73 00 63 00 6F 00 72 00 6C 00 69 00 62 00 // m.s.c.o.r.l.i.b.
2C 00 20 00 56 00 65 00 72 00 73 00 69 00 6F 00 // ,. .V.e.r.s.i.o.
6E 00 3D 00 32 00 2E 00 30 00 2E 00 30 00 2E 00 // n.=.2...0...0...
30 00 2C 00 20 00 43 00 75 00 6C 00 74 00 75 00 // 0.,. .C.u.l.t.u.
72 00 65 00 3D 00 6E 00 65 00 75 00 74 00 72 00 // r.e.=.n.e.u.t.r.
61 00 6C 00 2C 00 20 00 50 00 75 00 62 00 6C 00 // a.l.,. .P.u.b.l.
69 00 63 00 4B 00 65 00 79 00 54 00 6F 00 6B 00 // i.c.K.e.y.T.o.k.
65 00 6E 00 3D 00 62 00 37 00 37 00 61 00 35 00 // e.n.=.b.7.7.a.5.
63 00 35 00 36 00 31 00 39 00 33 00 34 00 65 00 // c.5.6.1.9.3.4.e.
30 00 38 00 39 00 22 00 0D 00 0A 00 76 00 65 00 // 0.8.9.".....v.e.
72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 // r.s.i.o.n.=.".1.
22 00 0D 00 0A 00 46 00 6C 00 61 00 67 00 73 00 // ".....F.l.a.g.s.
3D 00 22 00 53 00 6B 00 69 00 70 00 56 00 65 00 // =.".S.k.i.p.V.e.
72 00 69 00 66 00 69 00 63 00 61 00 74 00 69 00 // r.i.f.i.c.a.t.i.
6F 00 6E 00 22 00 2F 00 3E 00 0D 00 0A 00 3C 00 // o.n."./.>.....<.
2F 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // /.P.e.r.m.i.s.s.
69 00 6F 00 6E 00 53 00 65 00 74 00 3E 00 0D 00 // i.o.n.S.e.t.>...
0A 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ConstructorInitializers.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
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit SimpleStruct
extends [mscorlib]System.ValueType
{
.field public int32 Field1
.field public int32 Field2
} // end of class SimpleStruct
.class auto ansi nested public beforefieldinit UnsafeFields
extends [mscorlib]System.Object
{
.field public static int32 StaticSizeOf
.field public int32 SizeOf
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldarg.0
IL_0001: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::SizeOf
IL_000c: ldarg.0
IL_000d: call instance void [mscorlib]System.Object::.ctor()
IL_0012: ret
} // end of method UnsafeFields::.ctor
.method private specialname rtspecialname static
void .cctor() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0006: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::StaticSizeOf
IL_000b: ret
} // end of method UnsafeFields::.cctor
} // end of class UnsafeFields
.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 ConstructorInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

87
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.opt.il

@ -0,0 +1,87 @@
// 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 ConstructorInitializers.opt
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ConstructorInitializers.opt.dll
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit SimpleStruct
extends [mscorlib]System.ValueType
{
.field public int32 Field1
.field public int32 Field2
} // end of class SimpleStruct
.class auto ansi nested public beforefieldinit UnsafeFields
extends [mscorlib]System.Object
{
.field public static int32 StaticSizeOf
.field public int32 SizeOf
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldarg.0
IL_0001: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::SizeOf
IL_000c: ldarg.0
IL_000d: call instance void [mscorlib]System.Object::.ctor()
IL_0012: ret
} // end of method UnsafeFields::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0006: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::StaticSizeOf
IL_000b: ret
} // end of method UnsafeFields::.cctor
} // end of class UnsafeFields
.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 ConstructorInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

120
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.opt.mcs.il

@ -0,0 +1,120 @@
// Metadata version: v2.0.50727
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly ConstructorInitializers.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.
.permissionset reqmin
bytearray (3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // <.P.e.r.m.i.s.s.
69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00 // i.o.n.S.e.t. .c.
6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00 // l.a.s.s.=.".S.y.
73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00 // s.t.e.m...S.e.c.
75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00 // u.r.i.t.y...P.e.
72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
53 00 65 00 74 00 22 00 0D 00 0A 00 76 00 65 00 // S.e.t.".....v.e.
72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 // r.s.i.o.n.=.".1.
22 00 3E 00 0D 00 0A 00 3C 00 49 00 50 00 65 00 // ".>.....<.I.P.e.
72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
20 00 63 00 6C 00 61 00 73 00 73 00 3D 00 22 00 // .c.l.a.s.s.=.".
53 00 79 00 73 00 74 00 65 00 6D 00 2E 00 53 00 // S.y.s.t.e.m...S.
65 00 63 00 75 00 72 00 69 00 74 00 79 00 2E 00 // e.c.u.r.i.t.y...
50 00 65 00 72 00 6D 00 69 00 73 00 73 00 69 00 // P.e.r.m.i.s.s.i.
6F 00 6E 00 73 00 2E 00 53 00 65 00 63 00 75 00 // o.n.s...S.e.c.u.
72 00 69 00 74 00 79 00 50 00 65 00 72 00 6D 00 // r.i.t.y.P.e.r.m.
69 00 73 00 73 00 69 00 6F 00 6E 00 2C 00 20 00 // i.s.s.i.o.n.,. .
6D 00 73 00 63 00 6F 00 72 00 6C 00 69 00 62 00 // m.s.c.o.r.l.i.b.
2C 00 20 00 56 00 65 00 72 00 73 00 69 00 6F 00 // ,. .V.e.r.s.i.o.
6E 00 3D 00 32 00 2E 00 30 00 2E 00 30 00 2E 00 // n.=.2...0...0...
30 00 2C 00 20 00 43 00 75 00 6C 00 74 00 75 00 // 0.,. .C.u.l.t.u.
72 00 65 00 3D 00 6E 00 65 00 75 00 74 00 72 00 // r.e.=.n.e.u.t.r.
61 00 6C 00 2C 00 20 00 50 00 75 00 62 00 6C 00 // a.l.,. .P.u.b.l.
69 00 63 00 4B 00 65 00 79 00 54 00 6F 00 6B 00 // i.c.K.e.y.T.o.k.
65 00 6E 00 3D 00 62 00 37 00 37 00 61 00 35 00 // e.n.=.b.7.7.a.5.
63 00 35 00 36 00 31 00 39 00 33 00 34 00 65 00 // c.5.6.1.9.3.4.e.
30 00 38 00 39 00 22 00 0D 00 0A 00 76 00 65 00 // 0.8.9.".....v.e.
72 00 73 00 69 00 6F 00 6E 00 3D 00 22 00 31 00 // r.s.i.o.n.=.".1.
22 00 0D 00 0A 00 46 00 6C 00 61 00 67 00 73 00 // ".....F.l.a.g.s.
3D 00 22 00 53 00 6B 00 69 00 70 00 56 00 65 00 // =.".S.k.i.p.V.e.
72 00 69 00 66 00 69 00 63 00 61 00 74 00 69 00 // r.i.f.i.c.a.t.i.
6F 00 6E 00 22 00 2F 00 3E 00 0D 00 0A 00 3C 00 // o.n."./.>.....<.
2F 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // /.P.e.r.m.i.s.s.
69 00 6F 00 6E 00 53 00 65 00 74 00 3E 00 0D 00 // i.o.n.S.e.t.>...
0A 00 )
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ConstructorInitializers.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
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit SimpleStruct
extends [mscorlib]System.ValueType
{
.field public int32 Field1
.field public int32 Field2
} // end of class SimpleStruct
.class auto ansi nested public beforefieldinit UnsafeFields
extends [mscorlib]System.Object
{
.field public static int32 StaticSizeOf
.field public int32 SizeOf
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldarg.0
IL_0001: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::SizeOf
IL_000c: ldarg.0
IL_000d: call instance void [mscorlib]System.Object::.ctor()
IL_0012: ret
} // end of method UnsafeFields::.ctor
.method private specialname rtspecialname static
void .cctor() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0006: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::StaticSizeOf
IL_000b: ret
} // end of method UnsafeFields::.cctor
} // end of class UnsafeFields
.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 ConstructorInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

91
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.opt.roslyn.il

@ -0,0 +1,91 @@
// 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 ConstructorInitializers
{
.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 ConstructorInitializers.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.ConstructorInitializers
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit SimpleStruct
extends [mscorlib]System.ValueType
{
.field public int32 Field1
.field public int32 Field2
} // end of class SimpleStruct
.class auto ansi nested public beforefieldinit UnsafeFields
extends [mscorlib]System.Object
{
.field public static int32 StaticSizeOf
.field public int32 SizeOf
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 19 (0x13)
.maxstack 8
IL_0000: ldarg.0
IL_0001: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::SizeOf
IL_000c: ldarg.0
IL_000d: call instance void [mscorlib]System.Object::.ctor()
IL_0012: ret
} // end of method UnsafeFields::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0006: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::StaticSizeOf
IL_000b: ret
} // end of method UnsafeFields::.cctor
} // end of class UnsafeFields
.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 ConstructorInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

93
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ConstructorInitializers.roslyn.il

@ -0,0 +1,93 @@
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly ConstructorInitializers
{
.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 ConstructorInitializers.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.ConstructorInitializers
extends [mscorlib]System.Object
{
.class sequential ansi sealed nested public beforefieldinit SimpleStruct
extends [mscorlib]System.ValueType
{
.field public int32 Field1
.field public int32 Field2
} // end of class SimpleStruct
.class auto ansi nested public beforefieldinit UnsafeFields
extends [mscorlib]System.Object
{
.field public static int32 StaticSizeOf
.field public int32 SizeOf
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 20 (0x14)
.maxstack 8
IL_0000: ldarg.0
IL_0001: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0007: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::SizeOf
IL_000c: ldarg.0
IL_000d: call instance void [mscorlib]System.Object::.ctor()
IL_0012: nop
IL_0013: ret
} // end of method UnsafeFields::.ctor
.method private hidebysig specialname rtspecialname static
void .cctor() cil managed
{
// Code size 12 (0xc)
.maxstack 8
IL_0000: sizeof ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/SimpleStruct
IL_0006: stsfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers/UnsafeFields::StaticSizeOf
IL_000b: ret
} // end of method UnsafeFields::.cctor
} // end of class UnsafeFields
.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 ConstructorInitializers::.ctor
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.ConstructorInitializers
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************

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

@ -27,7 +27,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
{ {
public static class Extensions public static class Extensions
{ {
public static void Add(this TestCases.CustomList<int> inst, int a, int b) public static void Add(this TestCases.CustomList<int> inst, string a, string b)
{
}
public static void Add<T>(this IList<KeyValuePair<string, string>> collection, string key, T value, Func<T, string> convert = null)
{ {
} }
} }
@ -1152,6 +1156,74 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
} }
}); });
} }
private int[] Issue1383(int i, int[] array)
{
array = new int[4];
array[i++] = 1;
array[i++] = 2;
return array;
}
private string[,] Issue1382a()
{
return new string[4, 4] {
{
null,
"test",
"hello",
"world"
},
{
"test",
null,
"hello",
"world"
},
{
"test",
"hello",
null,
"world"
},
{
"test",
"hello",
"world",
null
}
};
}
private string[,] Issue1382b()
{
return new string[4, 4] {
{
"test",
"hello",
"world",
null
},
{
"test",
"hello",
null,
"world"
},
{
"test",
null,
"hello",
"world"
},
{
null,
"test",
"hello",
"world"
}
};
}
#endregion #endregion
#region Object initializers #region Object initializers
@ -1476,13 +1548,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
#if CS60 #if CS60
X(Y(), new CustomList<int> { X(Y(), new CustomList<int> {
{ {
1, "1",
2 "2"
} }
}); });
#else #else
CustomList<int> customList = new CustomList<int>(); CustomList<int> customList = new CustomList<int>();
customList.Add(1, 2); customList.Add("1", "2");
X(Y(), customList); X(Y(), customList);
#endif #endif
} }
@ -1635,7 +1707,33 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
[(object)value] = new S(value) [(object)value] = new S(value)
}); });
} }
public static void Issue1390(IEnumerable<string> tokens, bool alwaysAllowAdministrators, char wireDelimiter)
{
#if OPT
List<KeyValuePair<string, string>> obj = new List<KeyValuePair<string, string>> {
#else
List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>> {
#endif
{
"tokens",
string.Join(wireDelimiter.ToString(), tokens),
(Func<string, string>)null
},
{
"alwaysAllowAdministrators",
alwaysAllowAdministrators.ToString(),
(Func<string, string>)null
},
{
"delimiter",
wireDelimiter.ToString(),
(Func<string, string>)null
}
};
}
#endif #endif
#endregion #endregion
} }
} }

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

@ -15,10 +15,10 @@
} }
.assembly InitializerTests .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 .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. 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.permissionset reqmin .permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004 .hash algorithm 0x00008004
@ -40,10 +40,23 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst, .method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst,
int32 a, string a,
int32 b) cil managed string b) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Extensions::Add
.method public hidebysig static void Add<T>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>> collection,
string key,
!!T 'value',
[opt] class [mscorlib]System.Func`2<!!T,string> convert) cil managed
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.param [4] = nullref
// Code size 2 (0x2) // Code size 2 (0x2)
.maxstack 8 .maxstack 8
IL_0000: nop IL_0000: nop
@ -1413,7 +1426,7 @@
IL_0006: ldc.i4.s 10 IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.Int32 IL_0008: newarr [mscorlib]System.Int32
IL_000d: dup IL_000d: dup
IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000a-1' IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000b-1'
IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1471,7 +1484,7 @@
IL_000f: ldc.i4.s 10 IL_000f: ldc.i4.s 10
IL_0011: newarr [mscorlib]System.Int32 IL_0011: newarr [mscorlib]System.Int32
IL_0016: dup IL_0016: dup
IL_0017: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000c-1' IL_0017: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_001c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_001c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0021: stelem.ref IL_0021: stelem.ref
@ -1499,7 +1512,7 @@
IL_003b: ldc.i4.6 IL_003b: ldc.i4.6
IL_003c: newarr [mscorlib]System.Int32 IL_003c: newarr [mscorlib]System.Int32
IL_0041: dup IL_0041: dup
IL_0042: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x600000c-2' IL_0042: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x600000d-2'
IL_0047: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0047: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_004c: stelem.ref IL_004c: stelem.ref
@ -1762,7 +1775,7 @@
IL_0006: ldc.i4.8 IL_0006: ldc.i4.8
IL_0007: newarr [mscorlib]System.Boolean IL_0007: newarr [mscorlib]System.Boolean
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x600000f-1' IL_000d: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x6000010-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1780,7 +1793,7 @@
IL_0006: ldc.i4.s 10 IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.Byte IL_0008: newarr [mscorlib]System.Byte
IL_000d: dup IL_000d: dup
IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000010-1' IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000011-1'
IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1798,7 +1811,7 @@
IL_0006: ldc.i4.8 IL_0006: ldc.i4.8
IL_0007: newarr [mscorlib]System.SByte IL_0007: newarr [mscorlib]System.SByte
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x6000011-1' IL_000d: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x6000012-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1816,7 +1829,7 @@
IL_0006: ldc.i4.5 IL_0006: ldc.i4.5
IL_0007: newarr [mscorlib]System.Int16 IL_0007: newarr [mscorlib]System.Int16
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000012-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1834,7 +1847,7 @@
IL_0006: ldc.i4.6 IL_0006: ldc.i4.6
IL_0007: newarr [mscorlib]System.UInt16 IL_0007: newarr [mscorlib]System.UInt16
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x6000013-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x6000014-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1852,7 +1865,7 @@
IL_0006: ldc.i4.s 10 IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.Int32 IL_0008: newarr [mscorlib]System.Int32
IL_000d: dup IL_000d: dup
IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000014-1' IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000015-1'
IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1870,7 +1883,7 @@
IL_0006: ldc.i4.s 10 IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.UInt32 IL_0008: newarr [mscorlib]System.UInt32
IL_000d: dup IL_000d: dup
IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000015-1' IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000016-1'
IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1888,7 +1901,7 @@
IL_0006: ldc.i4.5 IL_0006: ldc.i4.5
IL_0007: newarr [mscorlib]System.Int64 IL_0007: newarr [mscorlib]System.Int64
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000016-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000017-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1906,7 +1919,7 @@
IL_0006: ldc.i4.s 10 IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.UInt64 IL_0008: newarr [mscorlib]System.UInt64
IL_000d: dup IL_000d: dup
IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '<PrivateImplementationDetails>'::'$$method0x6000017-1' IL_000e: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '<PrivateImplementationDetails>'::'$$method0x6000018-1'
IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0013: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1924,7 +1937,7 @@
IL_0006: ldc.i4.6 IL_0006: ldc.i4.6
IL_0007: newarr [mscorlib]System.Single IL_0007: newarr [mscorlib]System.Single
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x6000018-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x6000019-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1942,7 +1955,7 @@
IL_0006: ldc.i4.6 IL_0006: ldc.i4.6
IL_0007: newarr [mscorlib]System.Double IL_0007: newarr [mscorlib]System.Double
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '<PrivateImplementationDetails>'::'$$method0x6000019-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '<PrivateImplementationDetails>'::'$$method0x600001a-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -2088,7 +2101,7 @@
IL_0004: newobj instance void int32[0...,0...]::.ctor(int32, IL_0004: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_0009: dup IL_0009: dup
IL_000a: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '<PrivateImplementationDetails>'::'$$method0x600001d-1' IL_000a: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '<PrivateImplementationDetails>'::'$$method0x600001e-1'
IL_000f: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_000f: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0014: stloc.0 IL_0014: stloc.0
@ -2116,7 +2129,7 @@
IL_000c: newobj instance void int32[0...,0...]::.ctor(int32, IL_000c: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_0011: dup IL_0011: dup
IL_0012: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-1' IL_0012: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-1'
IL_0017: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0017: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001c: stelem.ref IL_001c: stelem.ref
@ -2127,7 +2140,7 @@
IL_0021: newobj instance void int32[0...,0...]::.ctor(int32, IL_0021: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_0026: dup IL_0026: dup
IL_0027: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-2' IL_0027: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-2'
IL_002c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_002c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0031: stelem.ref IL_0031: stelem.ref
@ -2138,7 +2151,7 @@
IL_0036: newobj instance void int32[0...,0...]::.ctor(int32, IL_0036: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_003b: dup IL_003b: dup
IL_003c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-3' IL_003c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-3'
IL_0041: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0041: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0046: stelem.ref IL_0046: stelem.ref
@ -2149,7 +2162,7 @@
IL_004b: newobj instance void int32[0...,0...]::.ctor(int32, IL_004b: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_0050: dup IL_0050: dup
IL_0051: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-4' IL_0051: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-4'
IL_0056: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0056: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_005b: stelem.ref IL_005b: stelem.ref
@ -2181,7 +2194,7 @@
int32, int32,
int32) int32)
IL_0012: dup IL_0012: dup
IL_0013: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x600001f-1' IL_0013: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x6000020-1'
IL_0018: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0018: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001d: stelem.ref IL_001d: stelem.ref
@ -2194,7 +2207,7 @@
int32, int32,
int32) int32)
IL_0028: dup IL_0028: dup
IL_0029: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x600001f-2' IL_0029: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x6000020-2'
IL_002e: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_002e: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0033: stelem.ref IL_0033: stelem.ref
@ -2395,6 +2408,251 @@
IL_0020: ret IL_0020: ret
} // end of method TestCases::Issue907_Test3 } // end of method TestCases::Issue907_Test3
.method private hidebysig instance int32[]
Issue1383(int32 i,
int32[] 'array') cil managed
{
// Code size 33 (0x21)
.maxstack 4
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: newarr [mscorlib]System.Int32
IL_0007: starg.s 'array'
IL_0009: ldarg.2
IL_000a: ldarg.1
IL_000b: dup
IL_000c: ldc.i4.1
IL_000d: add
IL_000e: starg.s i
IL_0010: ldc.i4.1
IL_0011: stelem.i4
IL_0012: ldarg.2
IL_0013: ldarg.1
IL_0014: dup
IL_0015: ldc.i4.1
IL_0016: add
IL_0017: starg.s i
IL_0019: ldc.i4.2
IL_001a: stelem.i4
IL_001b: ldarg.2
IL_001c: stloc.0
IL_001d: br.s IL_001f
IL_001f: ldloc.0
IL_0020: ret
} // end of method TestCases::Issue1383
.method private hidebysig instance string[0...,0...]
Issue1382a() cil managed
{
// Code size 171 (0xab)
.maxstack 4
.locals init (string[0...,0...] V_0,
string[0...,0...] V_1)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: ldc.i4.4
IL_0003: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0008: stloc.1
IL_0009: ldloc.1
IL_000a: ldc.i4.0
IL_000b: ldc.i4.1
IL_000c: ldstr "test"
IL_0011: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0016: ldloc.1
IL_0017: ldc.i4.0
IL_0018: ldc.i4.2
IL_0019: ldstr "hello"
IL_001e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0023: ldloc.1
IL_0024: ldc.i4.0
IL_0025: ldc.i4.3
IL_0026: ldstr "world"
IL_002b: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0030: ldloc.1
IL_0031: ldc.i4.1
IL_0032: ldc.i4.0
IL_0033: ldstr "test"
IL_0038: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003d: ldloc.1
IL_003e: ldc.i4.1
IL_003f: ldc.i4.2
IL_0040: ldstr "hello"
IL_0045: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_004a: ldloc.1
IL_004b: ldc.i4.1
IL_004c: ldc.i4.3
IL_004d: ldstr "world"
IL_0052: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0057: ldloc.1
IL_0058: ldc.i4.2
IL_0059: ldc.i4.0
IL_005a: ldstr "test"
IL_005f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0064: ldloc.1
IL_0065: ldc.i4.2
IL_0066: ldc.i4.1
IL_0067: ldstr "hello"
IL_006c: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0071: ldloc.1
IL_0072: ldc.i4.2
IL_0073: ldc.i4.3
IL_0074: ldstr "world"
IL_0079: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007e: ldloc.1
IL_007f: ldc.i4.3
IL_0080: ldc.i4.0
IL_0081: ldstr "test"
IL_0086: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_008b: ldloc.1
IL_008c: ldc.i4.3
IL_008d: ldc.i4.1
IL_008e: ldstr "hello"
IL_0093: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0098: ldloc.1
IL_0099: ldc.i4.3
IL_009a: ldc.i4.2
IL_009b: ldstr "world"
IL_00a0: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a5: ldloc.1
IL_00a6: stloc.0
IL_00a7: br.s IL_00a9
IL_00a9: ldloc.0
IL_00aa: ret
} // end of method TestCases::Issue1382a
.method private hidebysig instance string[0...,0...]
Issue1382b() cil managed
{
// Code size 171 (0xab)
.maxstack 4
.locals init (string[0...,0...] V_0,
string[0...,0...] V_1)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: ldc.i4.4
IL_0003: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0008: stloc.1
IL_0009: ldloc.1
IL_000a: ldc.i4.0
IL_000b: ldc.i4.0
IL_000c: ldstr "test"
IL_0011: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0016: ldloc.1
IL_0017: ldc.i4.0
IL_0018: ldc.i4.1
IL_0019: ldstr "hello"
IL_001e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0023: ldloc.1
IL_0024: ldc.i4.0
IL_0025: ldc.i4.2
IL_0026: ldstr "world"
IL_002b: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0030: ldloc.1
IL_0031: ldc.i4.1
IL_0032: ldc.i4.0
IL_0033: ldstr "test"
IL_0038: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003d: ldloc.1
IL_003e: ldc.i4.1
IL_003f: ldc.i4.1
IL_0040: ldstr "hello"
IL_0045: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_004a: ldloc.1
IL_004b: ldc.i4.1
IL_004c: ldc.i4.3
IL_004d: ldstr "world"
IL_0052: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0057: ldloc.1
IL_0058: ldc.i4.2
IL_0059: ldc.i4.0
IL_005a: ldstr "test"
IL_005f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0064: ldloc.1
IL_0065: ldc.i4.2
IL_0066: ldc.i4.2
IL_0067: ldstr "hello"
IL_006c: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0071: ldloc.1
IL_0072: ldc.i4.2
IL_0073: ldc.i4.3
IL_0074: ldstr "world"
IL_0079: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007e: ldloc.1
IL_007f: ldc.i4.3
IL_0080: ldc.i4.1
IL_0081: ldstr "test"
IL_0086: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_008b: ldloc.1
IL_008c: ldc.i4.3
IL_008d: ldc.i4.2
IL_008e: ldstr "hello"
IL_0093: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0098: ldloc.1
IL_0099: ldc.i4.3
IL_009a: ldc.i4.3
IL_009b: ldstr "world"
IL_00a0: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a5: ldloc.1
IL_00a6: stloc.0
IL_00a7: br.s IL_00a9
IL_00a9: ldloc.0
IL_00aa: ret
} // end of method TestCases::Issue1382b
.method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C
Test1() cil managed Test1() cil managed
{ {
@ -3170,7 +3428,7 @@
IL_0001: ldc.i4.4 IL_0001: ldc.i4.4
IL_0002: newarr [mscorlib]System.Byte IL_0002: newarr [mscorlib]System.Byte
IL_0007: dup IL_0007: dup
IL_0008: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000041-1' IL_0008: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000045-1'
IL_000d: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_000d: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0012: stloc.0 IL_0012: stloc.0
@ -3295,34 +3553,25 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed .method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{ {
// Code size 43 (0x2b) // Code size 37 (0x25)
.maxstack 4 .maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0, .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
int32[] V_1)
IL_0000: nop IL_0000: nop
IL_0001: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor() IL_0001: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor()
IL_0006: stloc.0 IL_0006: stloc.0
IL_0007: ldloc.0 IL_0007: ldloc.0
IL_0008: ldc.i4.2 IL_0008: ldstr "1"
IL_0009: newarr [mscorlib]System.Int32 IL_000d: ldstr "2"
IL_000e: stloc.1 IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
IL_000f: ldloc.1 string,
IL_0010: ldc.i4.0 string)
IL_0011: ldc.i4.1 IL_0017: nop
IL_0012: stelem.i4 IL_0018: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0013: ldloc.1 IL_001d: ldloc.0
IL_0014: ldc.i4.1 IL_001e: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
IL_0015: ldc.i4.2
IL_0016: stelem.i4
IL_0017: ldloc.1
IL_0018: callvirt instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::Add(int32[])
IL_001d: nop
IL_001e: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0023: ldloc.0
IL_0024: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object) object)
IL_0029: nop IL_0023: nop
IL_002a: ret IL_0024: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer } // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed .method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -4435,7 +4684,7 @@
IL_0787: newobj instance void int32[0...,0...]::.ctor(int32, IL_0787: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_078c: dup IL_078c: dup
IL_078d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '<PrivateImplementationDetails>'::'$$method0x6000090-1' IL_078d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '<PrivateImplementationDetails>'::'$$method0x6000094-1'
IL_0792: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0792: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0797: stsfld int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Issue1336_rg2 IL_0797: stsfld int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Issue1336_rg2
@ -4518,29 +4767,29 @@
.size 36 .size 36
} // end of class '__StaticArrayInitTypeSize=36' } // end of class '__StaticArrayInitTypeSize=36'
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000a-1' at I_000020C0 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000b-1' at I_000020C0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000c-1' at I_00002138 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000d-1' at I_00002138
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000c-2' at I_00002160 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000d-2' at I_00002160
.field static assembly int64 '$$method0x600000f-1' at I_00002418 .field static assembly int64 '$$method0x6000010-1' at I_00002418
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000010-1' at I_00002440 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000011-1' at I_00002440
.field static assembly int64 '$$method0x6000011-1' at I_00002470 .field static assembly int64 '$$method0x6000012-1' at I_00002470
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000012-1' at I_00002498 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000013-1' at I_00002498
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000013-1' at I_000024C8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000014-1' at I_000024C8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000014-1' at I_000024F8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000015-1' at I_000024F8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000015-1' at I_00002540 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_00002540
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_00002588 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000017-1' at I_00002588
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000017-1' at I_000025D0 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000018-1' at I_000025D0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000018-1' at I_00002640 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000019-1' at I_00002640
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x6000019-1' at I_00002678 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x600001a-1' at I_00002678
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001d-1' at I_000027C0 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001e-1' at I_000027C0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-1' at I_000028E8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-1' at I_000028E8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-2' at I_00002928 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-2' at I_00002928
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-3' at I_00002968 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-3' at I_00002968
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-4' at I_000029A8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-4' at I_000029A8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-1' at I_00002A58 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-1' at I_00002A58
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-2' at I_00002AA0 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-2' at I_00002AA0
.field static assembly int32 '$$method0x6000041-1' at I_00003318 .field static assembly int32 '$$method0x6000045-1' at I_000034B8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000090-1' at I_00003600 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000094-1' at I_000037A0
} // end of class '<PrivateImplementationDetails>' } // end of class '<PrivateImplementationDetails>'
@ -4648,10 +4897,10 @@
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!... 1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%... 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'... 26 00 00 00 27 00 00 00) // &...'...
.data cil I_00003318 = bytearray ( .data cil I_000034B8 = bytearray (
00 01 02 FF) 00 01 02 FF)
.data cil I_0000331C = int8[228] .data cil I_000034BC = int8[4]
.data cil I_00003600 = bytearray ( .data cil I_000037A0 = bytearray (
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00) 01 00 00 00)

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

@ -15,10 +15,10 @@
} }
.assembly InitializerTests.opt .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 .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. 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.permissionset reqmin .permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004 .hash algorithm 0x00008004
@ -40,10 +40,22 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst, .method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst,
int32 a, string a,
int32 b) cil managed string b) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Extensions::Add
.method public hidebysig static void Add<T>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>> collection,
string key,
!!T 'value',
[opt] class [mscorlib]System.Func`2<!!T,string> convert) cil managed
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.param [4] = nullref
// Code size 1 (0x1) // Code size 1 (0x1)
.maxstack 8 .maxstack 8
IL_0000: ret IL_0000: ret
@ -1226,7 +1238,7 @@
IL_0005: ldc.i4.s 10 IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.Int32 IL_0007: newarr [mscorlib]System.Int32
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000a-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000b-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1280,7 +1292,7 @@
IL_000e: ldc.i4.s 10 IL_000e: ldc.i4.s 10
IL_0010: newarr [mscorlib]System.Int32 IL_0010: newarr [mscorlib]System.Int32
IL_0015: dup IL_0015: dup
IL_0016: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000c-1' IL_0016: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x600000d-1'
IL_001b: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_001b: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0020: stelem.ref IL_0020: stelem.ref
@ -1308,7 +1320,7 @@
IL_003a: ldc.i4.6 IL_003a: ldc.i4.6
IL_003b: newarr [mscorlib]System.Int32 IL_003b: newarr [mscorlib]System.Int32
IL_0040: dup IL_0040: dup
IL_0041: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x600000c-2' IL_0041: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x600000d-2'
IL_0046: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0046: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_004b: stelem.ref IL_004b: stelem.ref
@ -1571,7 +1583,7 @@
IL_0005: ldc.i4.8 IL_0005: ldc.i4.8
IL_0006: newarr [mscorlib]System.Boolean IL_0006: newarr [mscorlib]System.Boolean
IL_000b: dup IL_000b: dup
IL_000c: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x600000f-1' IL_000c: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x6000010-1'
IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1587,7 +1599,7 @@
IL_0005: ldc.i4.s 10 IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.Byte IL_0007: newarr [mscorlib]System.Byte
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000010-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000011-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1603,7 +1615,7 @@
IL_0005: ldc.i4.8 IL_0005: ldc.i4.8
IL_0006: newarr [mscorlib]System.SByte IL_0006: newarr [mscorlib]System.SByte
IL_000b: dup IL_000b: dup
IL_000c: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x6000011-1' IL_000c: ldtoken field int64 '<PrivateImplementationDetails>'::'$$method0x6000012-1'
IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1619,7 +1631,7 @@
IL_0005: ldc.i4.5 IL_0005: ldc.i4.5
IL_0006: newarr [mscorlib]System.Int16 IL_0006: newarr [mscorlib]System.Int16
IL_000b: dup IL_000b: dup
IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000012-1' IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '<PrivateImplementationDetails>'::'$$method0x6000013-1'
IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1635,7 +1647,7 @@
IL_0005: ldc.i4.6 IL_0005: ldc.i4.6
IL_0006: newarr [mscorlib]System.UInt16 IL_0006: newarr [mscorlib]System.UInt16
IL_000b: dup IL_000b: dup
IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x6000013-1' IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '<PrivateImplementationDetails>'::'$$method0x6000014-1'
IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1651,7 +1663,7 @@
IL_0005: ldc.i4.s 10 IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.Int32 IL_0007: newarr [mscorlib]System.Int32
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000014-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000015-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1667,7 +1679,7 @@
IL_0005: ldc.i4.s 10 IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.UInt32 IL_0007: newarr [mscorlib]System.UInt32
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000015-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000016-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1683,7 +1695,7 @@
IL_0005: ldc.i4.5 IL_0005: ldc.i4.5
IL_0006: newarr [mscorlib]System.Int64 IL_0006: newarr [mscorlib]System.Int64
IL_000b: dup IL_000b: dup
IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000016-1' IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '<PrivateImplementationDetails>'::'$$method0x6000017-1'
IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1699,7 +1711,7 @@
IL_0005: ldc.i4.s 10 IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.UInt64 IL_0007: newarr [mscorlib]System.UInt64
IL_000c: dup IL_000c: dup
IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '<PrivateImplementationDetails>'::'$$method0x6000017-1' IL_000d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '<PrivateImplementationDetails>'::'$$method0x6000018-1'
IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0012: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1715,7 +1727,7 @@
IL_0005: ldc.i4.6 IL_0005: ldc.i4.6
IL_0006: newarr [mscorlib]System.Single IL_0006: newarr [mscorlib]System.Single
IL_000b: dup IL_000b: dup
IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x6000018-1' IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '<PrivateImplementationDetails>'::'$$method0x6000019-1'
IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1731,7 +1743,7 @@
IL_0005: ldc.i4.6 IL_0005: ldc.i4.6
IL_0006: newarr [mscorlib]System.Double IL_0006: newarr [mscorlib]System.Double
IL_000b: dup IL_000b: dup
IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '<PrivateImplementationDetails>'::'$$method0x6000019-1' IL_000c: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '<PrivateImplementationDetails>'::'$$method0x600001a-1'
IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0011: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object, IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1868,7 +1880,7 @@
IL_0003: newobj instance void int32[0...,0...]::.ctor(int32, IL_0003: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_0008: dup IL_0008: dup
IL_0009: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '<PrivateImplementationDetails>'::'$$method0x600001d-1' IL_0009: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '<PrivateImplementationDetails>'::'$$method0x600001e-1'
IL_000e: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_000e: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0013: ret IL_0013: ret
@ -1890,7 +1902,7 @@
IL_000b: newobj instance void int32[0...,0...]::.ctor(int32, IL_000b: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_0010: dup IL_0010: dup
IL_0011: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-1' IL_0011: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-1'
IL_0016: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0016: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001b: stelem.ref IL_001b: stelem.ref
@ -1901,7 +1913,7 @@
IL_0020: newobj instance void int32[0...,0...]::.ctor(int32, IL_0020: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_0025: dup IL_0025: dup
IL_0026: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-2' IL_0026: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-2'
IL_002b: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_002b: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0030: stelem.ref IL_0030: stelem.ref
@ -1912,7 +1924,7 @@
IL_0035: newobj instance void int32[0...,0...]::.ctor(int32, IL_0035: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_003a: dup IL_003a: dup
IL_003b: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-3' IL_003b: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-3'
IL_0040: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0040: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0045: stelem.ref IL_0045: stelem.ref
@ -1923,7 +1935,7 @@
IL_004a: newobj instance void int32[0...,0...]::.ctor(int32, IL_004a: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_004f: dup IL_004f: dup
IL_0050: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001e-4' IL_0050: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '<PrivateImplementationDetails>'::'$$method0x600001f-4'
IL_0055: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0055: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_005a: stelem.ref IL_005a: stelem.ref
@ -1949,7 +1961,7 @@
int32, int32,
int32) int32)
IL_0011: dup IL_0011: dup
IL_0012: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x600001f-1' IL_0012: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x6000020-1'
IL_0017: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_0017: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001c: stelem.ref IL_001c: stelem.ref
@ -1962,7 +1974,7 @@
int32, int32,
int32) int32)
IL_0027: dup IL_0027: dup
IL_0028: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x600001f-2' IL_0028: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '<PrivateImplementationDetails>'::'$$method0x6000020-2'
IL_002d: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_002d: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0032: stelem.ref IL_0032: stelem.ref
@ -2141,6 +2153,233 @@
IL_001d: ret IL_001d: ret
} // end of method TestCases::Issue907_Test3 } // end of method TestCases::Issue907_Test3
.method private hidebysig instance int32[]
Issue1383(int32 i,
int32[] 'array') cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: ldc.i4.4
IL_0001: newarr [mscorlib]System.Int32
IL_0006: starg.s 'array'
IL_0008: ldarg.2
IL_0009: ldarg.1
IL_000a: dup
IL_000b: ldc.i4.1
IL_000c: add
IL_000d: starg.s i
IL_000f: ldc.i4.1
IL_0010: stelem.i4
IL_0011: ldarg.2
IL_0012: ldarg.1
IL_0013: dup
IL_0014: ldc.i4.1
IL_0015: add
IL_0016: starg.s i
IL_0018: ldc.i4.2
IL_0019: stelem.i4
IL_001a: ldarg.2
IL_001b: ret
} // end of method TestCases::Issue1383
.method private hidebysig instance string[0...,0...]
Issue1382a() cil managed
{
// Code size 166 (0xa6)
.maxstack 4
.locals init (string[0...,0...] V_0)
IL_0000: ldc.i4.4
IL_0001: ldc.i4.4
IL_0002: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: ldstr "test"
IL_0010: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0015: ldloc.0
IL_0016: ldc.i4.0
IL_0017: ldc.i4.2
IL_0018: ldstr "hello"
IL_001d: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0022: ldloc.0
IL_0023: ldc.i4.0
IL_0024: ldc.i4.3
IL_0025: ldstr "world"
IL_002a: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_002f: ldloc.0
IL_0030: ldc.i4.1
IL_0031: ldc.i4.0
IL_0032: ldstr "test"
IL_0037: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003c: ldloc.0
IL_003d: ldc.i4.1
IL_003e: ldc.i4.2
IL_003f: ldstr "hello"
IL_0044: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0049: ldloc.0
IL_004a: ldc.i4.1
IL_004b: ldc.i4.3
IL_004c: ldstr "world"
IL_0051: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0056: ldloc.0
IL_0057: ldc.i4.2
IL_0058: ldc.i4.0
IL_0059: ldstr "test"
IL_005e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0063: ldloc.0
IL_0064: ldc.i4.2
IL_0065: ldc.i4.1
IL_0066: ldstr "hello"
IL_006b: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0070: ldloc.0
IL_0071: ldc.i4.2
IL_0072: ldc.i4.3
IL_0073: ldstr "world"
IL_0078: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007d: ldloc.0
IL_007e: ldc.i4.3
IL_007f: ldc.i4.0
IL_0080: ldstr "test"
IL_0085: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_008a: ldloc.0
IL_008b: ldc.i4.3
IL_008c: ldc.i4.1
IL_008d: ldstr "hello"
IL_0092: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0097: ldloc.0
IL_0098: ldc.i4.3
IL_0099: ldc.i4.2
IL_009a: ldstr "world"
IL_009f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a4: ldloc.0
IL_00a5: ret
} // end of method TestCases::Issue1382a
.method private hidebysig instance string[0...,0...]
Issue1382b() cil managed
{
// Code size 166 (0xa6)
.maxstack 4
.locals init (string[0...,0...] V_0)
IL_0000: ldc.i4.4
IL_0001: ldc.i4.4
IL_0002: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0007: stloc.0
IL_0008: ldloc.0
IL_0009: ldc.i4.0
IL_000a: ldc.i4.0
IL_000b: ldstr "test"
IL_0010: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0015: ldloc.0
IL_0016: ldc.i4.0
IL_0017: ldc.i4.1
IL_0018: ldstr "hello"
IL_001d: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0022: ldloc.0
IL_0023: ldc.i4.0
IL_0024: ldc.i4.2
IL_0025: ldstr "world"
IL_002a: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_002f: ldloc.0
IL_0030: ldc.i4.1
IL_0031: ldc.i4.0
IL_0032: ldstr "test"
IL_0037: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003c: ldloc.0
IL_003d: ldc.i4.1
IL_003e: ldc.i4.1
IL_003f: ldstr "hello"
IL_0044: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0049: ldloc.0
IL_004a: ldc.i4.1
IL_004b: ldc.i4.3
IL_004c: ldstr "world"
IL_0051: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0056: ldloc.0
IL_0057: ldc.i4.2
IL_0058: ldc.i4.0
IL_0059: ldstr "test"
IL_005e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0063: ldloc.0
IL_0064: ldc.i4.2
IL_0065: ldc.i4.2
IL_0066: ldstr "hello"
IL_006b: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0070: ldloc.0
IL_0071: ldc.i4.2
IL_0072: ldc.i4.3
IL_0073: ldstr "world"
IL_0078: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007d: ldloc.0
IL_007e: ldc.i4.3
IL_007f: ldc.i4.1
IL_0080: ldstr "test"
IL_0085: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_008a: ldloc.0
IL_008b: ldc.i4.3
IL_008c: ldc.i4.2
IL_008d: ldstr "hello"
IL_0092: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0097: ldloc.0
IL_0098: ldc.i4.3
IL_0099: ldc.i4.3
IL_009a: ldstr "world"
IL_009f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a4: ldloc.0
IL_00a5: ret
} // end of method TestCases::Issue1382b
.method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C
Test1() cil managed Test1() cil managed
{ {
@ -2780,7 +3019,7 @@
IL_0000: ldc.i4.4 IL_0000: ldc.i4.4
IL_0001: newarr [mscorlib]System.Byte IL_0001: newarr [mscorlib]System.Byte
IL_0006: dup IL_0006: dup
IL_0007: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000041-1' IL_0007: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000045-1'
IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0011: ret IL_0011: ret
@ -2879,31 +3118,22 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed .method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{ {
// Code size 40 (0x28) // Code size 34 (0x22)
.maxstack 4 .maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0, .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
int32[] V_1)
IL_0000: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor() IL_0000: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor()
IL_0005: stloc.0 IL_0005: stloc.0
IL_0006: ldloc.0 IL_0006: ldloc.0
IL_0007: ldc.i4.2 IL_0007: ldstr "1"
IL_0008: newarr [mscorlib]System.Int32 IL_000c: ldstr "2"
IL_000d: stloc.1 IL_0011: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
IL_000e: ldloc.1 string,
IL_000f: ldc.i4.0 string)
IL_0010: ldc.i4.1 IL_0016: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0011: stelem.i4 IL_001b: ldloc.0
IL_0012: ldloc.1 IL_001c: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
IL_0013: ldc.i4.1
IL_0014: ldc.i4.2
IL_0015: stelem.i4
IL_0016: ldloc.1
IL_0017: callvirt instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::Add(int32[])
IL_001c: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0021: ldloc.0
IL_0022: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object) object)
IL_0027: ret IL_0021: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer } // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed .method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -3991,7 +4221,7 @@
IL_07df: newobj instance void int32[0...,0...]::.ctor(int32, IL_07df: newobj instance void int32[0...,0...]::.ctor(int32,
int32) int32)
IL_07e4: dup IL_07e4: dup
IL_07e5: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '<PrivateImplementationDetails>'::'$$method0x6000090-1' IL_07e5: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '<PrivateImplementationDetails>'::'$$method0x6000094-1'
IL_07ea: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array, IL_07ea: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle) valuetype [mscorlib]System.RuntimeFieldHandle)
IL_07ef: stsfld int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Issue1336_rg2 IL_07ef: stsfld int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Issue1336_rg2
@ -4074,86 +4304,86 @@
.size 36 .size 36
} // end of class '__StaticArrayInitTypeSize=36' } // end of class '__StaticArrayInitTypeSize=36'
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000a-1' at I_00002070 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000b-1' at I_00002078
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000c-1' at I_000020E8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000d-1' at I_000020F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000c-2' at I_00002110 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000d-2' at I_00002118
.field static assembly int64 '$$method0x600000f-1' at I_000023D0 .field static assembly int64 '$$method0x6000010-1' at I_000023D8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000010-1' at I_000023F8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000011-1' at I_00002400
.field static assembly int64 '$$method0x6000011-1' at I_00002420 .field static assembly int64 '$$method0x6000012-1' at I_00002428
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000012-1' at I_00002448 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000013-1' at I_00002450
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000013-1' at I_00002470 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000014-1' at I_00002478
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000014-1' at I_000024A0 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000015-1' at I_000024A8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000015-1' at I_000024E8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_000024F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_00002530 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000017-1' at I_00002538
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000017-1' at I_00002578 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000018-1' at I_00002580
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000018-1' at I_000025E8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000019-1' at I_000025F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x6000019-1' at I_00002620 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x600001a-1' at I_00002628
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001d-1' at I_00002760 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001e-1' at I_00002768
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-1' at I_00002878 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-1' at I_00002880
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-2' at I_000028B8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-2' at I_000028C0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-3' at I_000028F8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-3' at I_00002900
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-4' at I_00002938 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-4' at I_00002940
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-1' at I_000029E8 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-1' at I_000029F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-2' at I_00002A30 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-2' at I_00002A38
.field static assembly int32 '$$method0x6000041-1' at I_00003200 .field static assembly int32 '$$method0x6000045-1' at I_00003390
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000090-1' at I_000034A0 .field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000094-1' at I_00003628
} // end of class '<PrivateImplementationDetails>' } // end of class '<PrivateImplementationDetails>'
// ============================================================= // =============================================================
.data cil I_00002070 = bytearray ( .data cil I_00002078 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_000020E8 = bytearray ( .data cil I_000020F0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_00002110 = bytearray ( .data cil I_00002118 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00) 05 00 00 00 06 00 00 00)
.data cil I_00002128 = int8[8] .data cil I_000023D8 = bytearray (
.data cil I_000023D0 = bytearray (
01 00 01 00 00 00 01 01) 01 00 01 00 00 00 01 01)
.data cil I_000023F8 = bytearray ( .data cil I_000023E0 = int8[32]
.data cil I_00002400 = bytearray (
01 02 03 04 05 06 07 08 FE FF) 01 02 03 04 05 06 07 08 FE FF)
.data cil I_00002402 = int8[30] .data cil I_0000240A = int8[6]
.data cil I_00002420 = bytearray ( .data cil I_00002428 = bytearray (
80 81 00 01 02 03 04 7F) 80 81 00 01 02 03 04 7F)
.data cil I_00002448 = bytearray ( .data cil I_00002450 = bytearray (
00 80 FF FF 00 00 01 00 FF 7F) 00 80 FF FF 00 00 01 00 FF 7F)
.data cil I_00002452 = int8[14] .data cil I_0000245A = int8[6]
.data cil I_00002470 = bytearray ( .data cil I_00002478 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF) 00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_0000247C = int8[4] .data cil I_00002484 = int8[4]
.data cil I_000024A0 = bytearray ( .data cil I_000024A8 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w.... 01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00 05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_000024E8 = bytearray ( .data cil I_000024F0 = bytearray (
01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^...... 01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_00002530 = bytearray ( .data cil I_00002538 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n.......... 01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_00002578 = bytearray ( .data cil I_00002560 = int8[32]
.data cil I_00002580 = bytearray (
01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w.... 01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^.............. 00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#.. FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_000025E8 = bytearray ( .data cil I_000025F0 = bytearray (
00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?.... 00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?....
00 00 80 7F 00 00 C0 FF) 00 00 80 7F 00 00 C0 FF)
.data cil I_00002620 = bytearray ( .data cil I_00002628 = bytearray (
00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00
00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........ 00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF) 00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_00002650 = int8[16] .data cil I_00002768 = bytearray (
.data cil I_00002760 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4170,43 +4400,43 @@
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_00002878 = bytearray ( .data cil I_00002868 = int8[24]
.data cil I_00002880 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_000028B8 = bytearray ( .data cil I_000028C0 = bytearray (
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_000028F8 = bytearray ( .data cil I_00002900 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_00002938 = bytearray ( .data cil I_00002940 = bytearray (
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_000029E8 = bytearray ( .data cil I_000029F0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00) 12 00 00 00 13 00 00 00)
.data cil I_00002A30 = bytearray ( .data cil I_00002A38 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!... 1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%... 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'... 26 00 00 00 27 00 00 00) // &...'...
.data cil I_00002A78 = int8[392] .data cil I_00003390 = bytearray (
.data cil I_00003200 = bytearray (
00 01 02 FF) 00 01 02 FF)
.data cil I_00003204 = int8[28] .data cil I_00003394 = int8[4]
.data cil I_000034A0 = bytearray ( .data cil I_00003628 = bytearray (
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00) 01 00 00 00)

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

@ -44,8 +44,8 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst, .method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst,
int32 a, string a,
int32 b) cil managed string b) cil managed
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 1 (0x1) // Code size 1 (0x1)
@ -53,6 +53,18 @@
IL_0000: ret IL_0000: ret
} // end of method Extensions::Add } // end of method Extensions::Add
.method public hidebysig static void Add<T>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>> collection,
string key,
!!T 'value',
[opt] class [mscorlib]System.Func`2<!!T,string> convert) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.param [4] = nullref
// Code size 1 (0x1)
.maxstack 8
IL_0000: ret
} // end of method Extensions::Add
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions } // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases .class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
@ -1188,8 +1200,8 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' '<>9' .field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__62_0' .field public static class [mscorlib]System.EventHandler '<>9__65_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__76_0' .field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__79_0'
.method private hidebysig specialname rtspecialname static .method private hidebysig specialname rtspecialname static
void .cctor() cil managed void .cctor() cil managed
{ {
@ -1211,17 +1223,17 @@
} // end of method '<>c'::.ctor } // end of method '<>c'::.ctor
.method assembly hidebysig instance void .method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__62_0'(object '<p0>', '<NotAnObjectInitializerWithEvent>b__65_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed class [mscorlib]System.EventArgs '<p1>') cil managed
{ {
// Code size 6 (0x6) // Code size 6 (0x6)
.maxstack 8 .maxstack 8
IL_0000: call void [mscorlib]System.Console::WriteLine() IL_0000: call void [mscorlib]System.Console::WriteLine()
IL_0005: ret IL_0005: ret
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__62_0' } // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'
.method assembly hidebysig instance bool .method assembly hidebysig instance bool
'<Issue270_NestedInitialisers>b__76_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed '<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{ {
// Code size 17 (0x11) // Code size 17 (0x11)
.maxstack 8 .maxstack 8
@ -1231,7 +1243,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string, IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string) string)
IL_0010: ret IL_0010: ret
} // end of method '<>c'::'<Issue270_NestedInitialisers>b__76_0' } // end of method '<>c'::'<Issue270_NestedInitialisers>b__79_0'
} // end of class '<>c' } // end of class '<>c'
@ -2128,6 +2140,227 @@
IL_001b: ret IL_001b: ret
} // end of method TestCases::Issue907_Test3 } // end of method TestCases::Issue907_Test3
.method private hidebysig instance int32[]
Issue1383(int32 i,
int32[] 'array') cil managed
{
// Code size 28 (0x1c)
.maxstack 8
IL_0000: ldc.i4.4
IL_0001: newarr [mscorlib]System.Int32
IL_0006: starg.s 'array'
IL_0008: ldarg.2
IL_0009: ldarg.1
IL_000a: dup
IL_000b: ldc.i4.1
IL_000c: add
IL_000d: starg.s i
IL_000f: ldc.i4.1
IL_0010: stelem.i4
IL_0011: ldarg.2
IL_0012: ldarg.1
IL_0013: dup
IL_0014: ldc.i4.1
IL_0015: add
IL_0016: starg.s i
IL_0018: ldc.i4.2
IL_0019: stelem.i4
IL_001a: ldarg.2
IL_001b: ret
} // end of method TestCases::Issue1383
.method private hidebysig instance string[0...,0...]
Issue1382a() cil managed
{
// Code size 164 (0xa4)
.maxstack 5
IL_0000: ldc.i4.4
IL_0001: ldc.i4.4
IL_0002: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.1
IL_000a: ldstr "test"
IL_000f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0014: dup
IL_0015: ldc.i4.0
IL_0016: ldc.i4.2
IL_0017: ldstr "hello"
IL_001c: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0021: dup
IL_0022: ldc.i4.0
IL_0023: ldc.i4.3
IL_0024: ldstr "world"
IL_0029: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_002e: dup
IL_002f: ldc.i4.1
IL_0030: ldc.i4.0
IL_0031: ldstr "test"
IL_0036: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003b: dup
IL_003c: ldc.i4.1
IL_003d: ldc.i4.2
IL_003e: ldstr "hello"
IL_0043: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0048: dup
IL_0049: ldc.i4.1
IL_004a: ldc.i4.3
IL_004b: ldstr "world"
IL_0050: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0055: dup
IL_0056: ldc.i4.2
IL_0057: ldc.i4.0
IL_0058: ldstr "test"
IL_005d: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0062: dup
IL_0063: ldc.i4.2
IL_0064: ldc.i4.1
IL_0065: ldstr "hello"
IL_006a: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_006f: dup
IL_0070: ldc.i4.2
IL_0071: ldc.i4.3
IL_0072: ldstr "world"
IL_0077: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007c: dup
IL_007d: ldc.i4.3
IL_007e: ldc.i4.0
IL_007f: ldstr "test"
IL_0084: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0089: dup
IL_008a: ldc.i4.3
IL_008b: ldc.i4.1
IL_008c: ldstr "hello"
IL_0091: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0096: dup
IL_0097: ldc.i4.3
IL_0098: ldc.i4.2
IL_0099: ldstr "world"
IL_009e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a3: ret
} // end of method TestCases::Issue1382a
.method private hidebysig instance string[0...,0...]
Issue1382b() cil managed
{
// Code size 164 (0xa4)
.maxstack 5
IL_0000: ldc.i4.4
IL_0001: ldc.i4.4
IL_0002: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0007: dup
IL_0008: ldc.i4.0
IL_0009: ldc.i4.0
IL_000a: ldstr "test"
IL_000f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0014: dup
IL_0015: ldc.i4.0
IL_0016: ldc.i4.1
IL_0017: ldstr "hello"
IL_001c: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0021: dup
IL_0022: ldc.i4.0
IL_0023: ldc.i4.2
IL_0024: ldstr "world"
IL_0029: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_002e: dup
IL_002f: ldc.i4.1
IL_0030: ldc.i4.0
IL_0031: ldstr "test"
IL_0036: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003b: dup
IL_003c: ldc.i4.1
IL_003d: ldc.i4.1
IL_003e: ldstr "hello"
IL_0043: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0048: dup
IL_0049: ldc.i4.1
IL_004a: ldc.i4.3
IL_004b: ldstr "world"
IL_0050: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0055: dup
IL_0056: ldc.i4.2
IL_0057: ldc.i4.0
IL_0058: ldstr "test"
IL_005d: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0062: dup
IL_0063: ldc.i4.2
IL_0064: ldc.i4.2
IL_0065: ldstr "hello"
IL_006a: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_006f: dup
IL_0070: ldc.i4.2
IL_0071: ldc.i4.3
IL_0072: ldstr "world"
IL_0077: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007c: dup
IL_007d: ldc.i4.3
IL_007e: ldc.i4.1
IL_007f: ldstr "test"
IL_0084: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0089: dup
IL_008a: ldc.i4.3
IL_008b: ldc.i4.2
IL_008c: ldstr "hello"
IL_0091: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0096: dup
IL_0097: ldc.i4.3
IL_0098: ldc.i4.3
IL_0099: ldstr "world"
IL_009e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a3: ret
} // end of method TestCases::Issue1382b
.method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C
Test1() cil managed Test1() cil managed
{ {
@ -2274,18 +2507,18 @@
IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::.ctor() IL_0000: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::.ctor()
IL_0005: stloc.0 IL_0005: stloc.0
IL_0006: ldloc.0 IL_0006: ldloc.0
IL_0007: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__62_0' IL_0007: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_000c: dup IL_000c: dup
IL_000d: brtrue.s IL_0026 IL_000d: brtrue.s IL_0026
IL_000f: pop IL_000f: pop
IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9' IL_0010: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__62_0'(object, IL_0015: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'(object,
class [mscorlib]System.EventArgs) class [mscorlib]System.EventArgs)
IL_001b: newobj instance void [mscorlib]System.EventHandler::.ctor(object, IL_001b: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int) native int)
IL_0020: dup IL_0020: dup
IL_0021: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__62_0' IL_0021: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_0026: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::add_TestEvent(class [mscorlib]System.EventHandler) IL_0026: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::add_TestEvent(class [mscorlib]System.EventHandler)
IL_002b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y() IL_002b: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0030: ldloc.0 IL_0030: ldloc.0
@ -2622,17 +2855,17 @@
IL_0033: callvirt instance void [mscorlib]System.Globalization.CultureInfo::set_DateTimeFormat(class [mscorlib]System.Globalization.DateTimeFormatInfo) IL_0033: callvirt instance void [mscorlib]System.Globalization.CultureInfo::set_DateTimeFormat(class [mscorlib]System.Globalization.DateTimeFormatInfo)
IL_0038: dup IL_0038: dup
IL_0039: ldloc.0 IL_0039: ldloc.0
IL_003a: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__76_0' IL_003a: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_003f: dup IL_003f: dup
IL_0040: brtrue.s IL_0059 IL_0040: brtrue.s IL_0059
IL_0042: pop IL_0042: pop
IL_0043: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9' IL_0043: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__76_0'(class [mscorlib]System.Globalization.NumberFormatInfo) IL_0048: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_004e: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object, IL_004e: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object,
native int) native int)
IL_0053: dup IL_0053: dup
IL_0054: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__76_0' IL_0054: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_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>, 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>) 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>) IL_005e: call !!0 [System.Core]System.Linq.Enumerable::First<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
@ -2818,28 +3051,19 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed .method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{ {
// Code size 38 (0x26) // Code size 32 (0x20)
.maxstack 6 .maxstack 8
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
IL_0000: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y() IL_0000: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0005: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor() IL_0005: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor()
IL_000a: stloc.0 IL_000a: dup
IL_000b: ldloc.0 IL_000b: ldstr "1"
IL_000c: ldc.i4.2 IL_0010: ldstr "2"
IL_000d: newarr [mscorlib]System.Int32 IL_0015: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
IL_0012: dup string,
IL_0013: ldc.i4.0 string)
IL_0014: ldc.i4.1 IL_001a: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
IL_0015: stelem.i4
IL_0016: dup
IL_0017: ldc.i4.1
IL_0018: ldc.i4.2
IL_0019: stelem.i4
IL_001a: callvirt instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::Add(int32[])
IL_001f: ldloc.0
IL_0020: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object) object)
IL_0025: ret IL_001f: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer } // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed .method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -3148,6 +3372,47 @@
IL_0023: ret IL_0023: ret
} // end of method TestCases::Issue1250_Test4 } // end of method TestCases::Issue1250_Test4
.method public hidebysig static void Issue1390(class [mscorlib]System.Collections.Generic.IEnumerable`1<string> tokens,
bool alwaysAllowAdministrators,
char wireDelimiter) cil managed
{
// Code size 70 (0x46)
.maxstack 5
IL_0000: newobj instance void class [mscorlib]System.Collections.Generic.List`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>::.ctor()
IL_0005: dup
IL_0006: ldstr "tokens"
IL_000b: ldarga.s wireDelimiter
IL_000d: call instance string [mscorlib]System.Char::ToString()
IL_0012: ldarg.0
IL_0013: call string [mscorlib]System.String::Join(string,
class [mscorlib]System.Collections.Generic.IEnumerable`1<string>)
IL_0018: ldnull
IL_0019: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add<string>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>,
string,
!!0,
class [mscorlib]System.Func`2<!!0,string>)
IL_001e: dup
IL_001f: ldstr "alwaysAllowAdministrators"
IL_0024: ldarga.s alwaysAllowAdministrators
IL_0026: call instance string [mscorlib]System.Boolean::ToString()
IL_002b: ldnull
IL_002c: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add<string>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>,
string,
!!0,
class [mscorlib]System.Func`2<!!0,string>)
IL_0031: dup
IL_0032: ldstr "delimiter"
IL_0037: ldarga.s wireDelimiter
IL_0039: call instance string [mscorlib]System.Char::ToString()
IL_003e: ldnull
IL_003f: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add<string>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>,
string,
!!0,
class [mscorlib]System.Func`2<!!0,string>)
IL_0044: pop
IL_0045: ret
} // end of method TestCases::Issue1390
.method public hidebysig specialname rtspecialname .method public hidebysig specialname rtspecialname
instance void .ctor() cil managed instance void .ctor() cil managed
{ {
@ -4046,67 +4311,68 @@
.size 256 .size 256
} // end of class '__StaticArrayInitTypeSize=256' } // end of class '__StaticArrayInitTypeSize=256'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00006C44 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007040
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_00006C8C .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_00007088
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_00006C9C .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_00007098
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_00006CE4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_000070E0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_00006CF4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_000070F0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00006D04 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007100
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00006D44 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007140
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_00006D6C .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_00007168
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_00006DBC .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000071B8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_00006EBC .field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000072B8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_00006EC4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_000072C0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_00006EEC .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_000072E8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00006F14 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007310
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00006F2C .field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007328
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00006F34 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007330
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_00006F64 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_00007360
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_00006FA4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000073A0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_00006FCC .field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_000073C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_00006FD4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_000073D0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00006FFC .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_000073F8
} // end of class '<PrivateImplementationDetails>' } // end of class '<PrivateImplementationDetails>'
// ============================================================= // =============================================================
.data cil I_00006C44 = bytearray ( .data cil I_00007040 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00) 12 00 00 00 13 00 00 00)
.data cil I_00006C8C = bytearray ( .data cil I_00007088 = bytearray (
01 02 03 04 05 06 07 08 FE FF) 01 02 03 04 05 06 07 08 FE FF)
.data cil I_00006C96 = int8[2] .data cil I_00007092 = int8[6]
.data cil I_00006C9C = bytearray ( .data cil I_00007098 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!... 1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%... 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'... 26 00 00 00 27 00 00 00) // &...'...
.data cil I_00006CE4 = bytearray ( .data cil I_000070E0 = bytearray (
00 80 FF FF 00 00 01 00 FF 7F) 00 80 FF FF 00 00 01 00 FF 7F)
.data cil I_00006CEE = int8[2] .data cil I_000070EA = int8[6]
.data cil I_00006CF4 = bytearray ( .data cil I_000070F0 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF) 00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_00006D04 = bytearray ( .data cil I_000070FC = int8[4]
.data cil I_00007100 = bytearray (
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_00006D44 = bytearray ( .data cil I_00007140 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n.......... 01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_00006D6C = bytearray ( .data cil I_00007168 = bytearray (
01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w.... 01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^.............. 00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#.. FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_00006DBC = bytearray ( .data cil I_000071B8 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4123,41 +4389,43 @@
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_00006EBC = bytearray ( .data cil I_000072B8 = bytearray (
80 81 00 01 02 03 04 7F) 80 81 00 01 02 03 04 7F)
.data cil I_00006EC4 = bytearray ( .data cil I_000072C0 = bytearray (
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00) 01 00 00 00)
.data cil I_00006EEC = bytearray ( .data cil I_000072E4 = int8[4]
.data cil I_000072E8 = bytearray (
01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^...... 01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_00006F14 = bytearray ( .data cil I_00007310 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00) 05 00 00 00 06 00 00 00)
.data cil I_00006F2C = bytearray ( .data cil I_00007328 = bytearray (
00 01 02 FF) 00 01 02 FF)
.data cil I_00006F34 = bytearray ( .data cil I_0000732C = int8[4]
.data cil I_00007330 = bytearray (
00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00
00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........ 00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF) 00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_00006F64 = bytearray ( .data cil I_00007360 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_00006FA4 = bytearray ( .data cil I_000073A0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_00006FCC = bytearray ( .data cil I_000073C8 = bytearray (
01 00 01 00 00 00 01 01) 01 00 01 00 00 00 01 01)
.data cil I_00006FD4 = bytearray ( .data cil I_000073D0 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w.... 01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00 05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_00006FFC = bytearray ( .data cil I_000073F8 = bytearray (
00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?.... 00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?....
00 00 80 7F 00 00 C0 FF) 00 00 80 7F 00 00 C0 FF)
// *********** DISASSEMBLY COMPLETE *********************** // *********** DISASSEMBLY COMPLETE ***********************

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

@ -44,8 +44,8 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst, .method public hidebysig static void Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> inst,
int32 a, string a,
int32 b) cil managed string b) cil managed
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 2 (0x2) // Code size 2 (0x2)
@ -54,6 +54,19 @@
IL_0001: ret IL_0001: ret
} // end of method Extensions::Add } // end of method Extensions::Add
.method public hidebysig static void Add<T>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>> collection,
string key,
!!T 'value',
[opt] class [mscorlib]System.Func`2<!!T,string> convert) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
.param [4] = nullref
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method Extensions::Add
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions } // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases .class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
@ -1257,8 +1270,8 @@
{ {
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' '<>9' .field public static initonly class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' '<>9'
.field public static class [mscorlib]System.EventHandler '<>9__62_0' .field public static class [mscorlib]System.EventHandler '<>9__65_0'
.field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__76_0' .field public static class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> '<>9__79_0'
.method private hidebysig specialname rtspecialname static .method private hidebysig specialname rtspecialname static
void .cctor() cil managed void .cctor() cil managed
{ {
@ -1281,7 +1294,7 @@
} // end of method '<>c'::.ctor } // end of method '<>c'::.ctor
.method assembly hidebysig instance void .method assembly hidebysig instance void
'<NotAnObjectInitializerWithEvent>b__62_0'(object '<p0>', '<NotAnObjectInitializerWithEvent>b__65_0'(object '<p0>',
class [mscorlib]System.EventArgs '<p1>') cil managed class [mscorlib]System.EventArgs '<p1>') cil managed
{ {
// Code size 8 (0x8) // Code size 8 (0x8)
@ -1290,10 +1303,10 @@
IL_0001: call void [mscorlib]System.Console::WriteLine() IL_0001: call void [mscorlib]System.Console::WriteLine()
IL_0006: nop IL_0006: nop
IL_0007: ret IL_0007: ret
} // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__62_0' } // end of method '<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'
.method assembly hidebysig instance bool .method assembly hidebysig instance bool
'<Issue270_NestedInitialisers>b__76_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed '<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo format) cil managed
{ {
// Code size 17 (0x11) // Code size 17 (0x11)
.maxstack 8 .maxstack 8
@ -1303,7 +1316,7 @@
IL_000b: call bool [mscorlib]System.String::op_Equality(string, IL_000b: call bool [mscorlib]System.String::op_Equality(string,
string) string)
IL_0010: ret IL_0010: ret
} // end of method '<>c'::'<Issue270_NestedInitialisers>b__76_0' } // end of method '<>c'::'<Issue270_NestedInitialisers>b__79_0'
} // end of class '<>c' } // end of class '<>c'
@ -2305,6 +2318,245 @@
IL_001e: ret IL_001e: ret
} // end of method TestCases::Issue907_Test3 } // end of method TestCases::Issue907_Test3
.method private hidebysig instance int32[]
Issue1383(int32 i,
int32[] 'array') cil managed
{
// Code size 33 (0x21)
.maxstack 4
.locals init (int32[] V_0)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: newarr [mscorlib]System.Int32
IL_0007: starg.s 'array'
IL_0009: ldarg.2
IL_000a: ldarg.1
IL_000b: dup
IL_000c: ldc.i4.1
IL_000d: add
IL_000e: starg.s i
IL_0010: ldc.i4.1
IL_0011: stelem.i4
IL_0012: ldarg.2
IL_0013: ldarg.1
IL_0014: dup
IL_0015: ldc.i4.1
IL_0016: add
IL_0017: starg.s i
IL_0019: ldc.i4.2
IL_001a: stelem.i4
IL_001b: ldarg.2
IL_001c: stloc.0
IL_001d: br.s IL_001f
IL_001f: ldloc.0
IL_0020: ret
} // end of method TestCases::Issue1383
.method private hidebysig instance string[0...,0...]
Issue1382a() cil managed
{
// Code size 169 (0xa9)
.maxstack 5
.locals init (string[0...,0...] V_0)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: ldc.i4.4
IL_0003: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0008: dup
IL_0009: ldc.i4.0
IL_000a: ldc.i4.1
IL_000b: ldstr "test"
IL_0010: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0015: dup
IL_0016: ldc.i4.0
IL_0017: ldc.i4.2
IL_0018: ldstr "hello"
IL_001d: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0022: dup
IL_0023: ldc.i4.0
IL_0024: ldc.i4.3
IL_0025: ldstr "world"
IL_002a: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_002f: dup
IL_0030: ldc.i4.1
IL_0031: ldc.i4.0
IL_0032: ldstr "test"
IL_0037: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003c: dup
IL_003d: ldc.i4.1
IL_003e: ldc.i4.2
IL_003f: ldstr "hello"
IL_0044: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0049: dup
IL_004a: ldc.i4.1
IL_004b: ldc.i4.3
IL_004c: ldstr "world"
IL_0051: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0056: dup
IL_0057: ldc.i4.2
IL_0058: ldc.i4.0
IL_0059: ldstr "test"
IL_005e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0063: dup
IL_0064: ldc.i4.2
IL_0065: ldc.i4.1
IL_0066: ldstr "hello"
IL_006b: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0070: dup
IL_0071: ldc.i4.2
IL_0072: ldc.i4.3
IL_0073: ldstr "world"
IL_0078: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007d: dup
IL_007e: ldc.i4.3
IL_007f: ldc.i4.0
IL_0080: ldstr "test"
IL_0085: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_008a: dup
IL_008b: ldc.i4.3
IL_008c: ldc.i4.1
IL_008d: ldstr "hello"
IL_0092: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0097: dup
IL_0098: ldc.i4.3
IL_0099: ldc.i4.2
IL_009a: ldstr "world"
IL_009f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a4: stloc.0
IL_00a5: br.s IL_00a7
IL_00a7: ldloc.0
IL_00a8: ret
} // end of method TestCases::Issue1382a
.method private hidebysig instance string[0...,0...]
Issue1382b() cil managed
{
// Code size 169 (0xa9)
.maxstack 5
.locals init (string[0...,0...] V_0)
IL_0000: nop
IL_0001: ldc.i4.4
IL_0002: ldc.i4.4
IL_0003: newobj instance void string[0...,0...]::.ctor(int32,
int32)
IL_0008: dup
IL_0009: ldc.i4.0
IL_000a: ldc.i4.0
IL_000b: ldstr "test"
IL_0010: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0015: dup
IL_0016: ldc.i4.0
IL_0017: ldc.i4.1
IL_0018: ldstr "hello"
IL_001d: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0022: dup
IL_0023: ldc.i4.0
IL_0024: ldc.i4.2
IL_0025: ldstr "world"
IL_002a: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_002f: dup
IL_0030: ldc.i4.1
IL_0031: ldc.i4.0
IL_0032: ldstr "test"
IL_0037: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_003c: dup
IL_003d: ldc.i4.1
IL_003e: ldc.i4.1
IL_003f: ldstr "hello"
IL_0044: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0049: dup
IL_004a: ldc.i4.1
IL_004b: ldc.i4.3
IL_004c: ldstr "world"
IL_0051: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0056: dup
IL_0057: ldc.i4.2
IL_0058: ldc.i4.0
IL_0059: ldstr "test"
IL_005e: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0063: dup
IL_0064: ldc.i4.2
IL_0065: ldc.i4.2
IL_0066: ldstr "hello"
IL_006b: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0070: dup
IL_0071: ldc.i4.2
IL_0072: ldc.i4.3
IL_0073: ldstr "world"
IL_0078: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_007d: dup
IL_007e: ldc.i4.3
IL_007f: ldc.i4.1
IL_0080: ldstr "test"
IL_0085: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_008a: dup
IL_008b: ldc.i4.3
IL_008c: ldc.i4.2
IL_008d: ldstr "hello"
IL_0092: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_0097: dup
IL_0098: ldc.i4.3
IL_0099: ldc.i4.3
IL_009a: ldstr "world"
IL_009f: call instance void string[0...,0...]::Set(int32,
int32,
string)
IL_00a4: stloc.0
IL_00a5: br.s IL_00a7
IL_00a7: ldloc.0
IL_00a8: ret
} // end of method TestCases::Issue1382b
.method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C .method public hidebysig instance class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/C
Test1() cil managed Test1() cil managed
{ {
@ -2508,18 +2760,18 @@
IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::.ctor() IL_0001: newobj instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::.ctor()
IL_0006: stloc.0 IL_0006: stloc.0
IL_0007: ldloc.0 IL_0007: ldloc.0
IL_0008: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__62_0' IL_0008: ldsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_000d: dup IL_000d: dup
IL_000e: brtrue.s IL_0027 IL_000e: brtrue.s IL_0027
IL_0010: pop IL_0010: pop
IL_0011: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9' IL_0011: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_0016: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__62_0'(object, IL_0016: ldftn instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<NotAnObjectInitializerWithEvent>b__65_0'(object,
class [mscorlib]System.EventArgs) class [mscorlib]System.EventArgs)
IL_001c: newobj instance void [mscorlib]System.EventHandler::.ctor(object, IL_001c: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int) native int)
IL_0021: dup IL_0021: dup
IL_0022: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__62_0' IL_0022: stsfld class [mscorlib]System.EventHandler ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__65_0'
IL_0027: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::add_TestEvent(class [mscorlib]System.EventHandler) IL_0027: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/Data::add_TestEvent(class [mscorlib]System.EventHandler)
IL_002c: nop IL_002c: nop
IL_002d: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y() IL_002d: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
@ -2919,17 +3171,17 @@
IL_003b: nop IL_003b: nop
IL_003c: dup IL_003c: dup
IL_003d: ldloc.0 IL_003d: ldloc.0
IL_003e: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__76_0' IL_003e: ldsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_0043: dup IL_0043: dup
IL_0044: brtrue.s IL_005d IL_0044: brtrue.s IL_005d
IL_0046: pop IL_0046: pop
IL_0047: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9' IL_0047: ldsfld class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c' ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9'
IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__76_0'(class [mscorlib]System.Globalization.NumberFormatInfo) IL_004c: ldftn instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<Issue270_NestedInitialisers>b__79_0'(class [mscorlib]System.Globalization.NumberFormatInfo)
IL_0052: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object, IL_0052: newobj instance void class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool>::.ctor(object,
native int) native int)
IL_0057: dup IL_0057: dup
IL_0058: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__76_0' IL_0058: stsfld class [mscorlib]System.Func`2<class [mscorlib]System.Globalization.NumberFormatInfo,bool> ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/'<>c'::'<>9__79_0'
IL_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>, 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>) 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>) IL_0062: call !!0 [System.Core]System.Linq.Enumerable::First<class [mscorlib]System.Globalization.NumberFormatInfo>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>)
@ -3190,31 +3442,22 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed .method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{ {
// Code size 41 (0x29) // Code size 35 (0x23)
.maxstack 6 .maxstack 8
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
IL_0000: nop IL_0000: nop
IL_0001: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y() IL_0001: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_0006: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor() IL_0006: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor()
IL_000b: stloc.0 IL_000b: dup
IL_000c: ldloc.0 IL_000c: ldstr "1"
IL_000d: ldc.i4.2 IL_0011: ldstr "2"
IL_000e: newarr [mscorlib]System.Int32 IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
IL_0013: dup string,
IL_0014: ldc.i4.0 string)
IL_0015: ldc.i4.1 IL_001b: nop
IL_0016: stelem.i4 IL_001c: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
IL_0017: dup
IL_0018: ldc.i4.1
IL_0019: ldc.i4.2
IL_001a: stelem.i4
IL_001b: callvirt instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::Add(int32[])
IL_0020: nop
IL_0021: ldloc.0
IL_0022: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object) object)
IL_0027: nop IL_0021: nop
IL_0028: ret IL_0022: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer } // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed .method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -3587,6 +3830,52 @@
IL_0026: ret IL_0026: ret
} // end of method TestCases::Issue1250_Test4 } // end of method TestCases::Issue1250_Test4
.method public hidebysig static void Issue1390(class [mscorlib]System.Collections.Generic.IEnumerable`1<string> tokens,
bool alwaysAllowAdministrators,
char wireDelimiter) cil managed
{
// Code size 74 (0x4a)
.maxstack 5
.locals init (class [mscorlib]System.Collections.Generic.List`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>> V_0)
IL_0000: nop
IL_0001: newobj instance void class [mscorlib]System.Collections.Generic.List`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>::.ctor()
IL_0006: dup
IL_0007: ldstr "tokens"
IL_000c: ldarga.s wireDelimiter
IL_000e: call instance string [mscorlib]System.Char::ToString()
IL_0013: ldarg.0
IL_0014: call string [mscorlib]System.String::Join(string,
class [mscorlib]System.Collections.Generic.IEnumerable`1<string>)
IL_0019: ldnull
IL_001a: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add<string>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>,
string,
!!0,
class [mscorlib]System.Func`2<!!0,string>)
IL_001f: nop
IL_0020: dup
IL_0021: ldstr "alwaysAllowAdministrators"
IL_0026: ldarga.s alwaysAllowAdministrators
IL_0028: call instance string [mscorlib]System.Boolean::ToString()
IL_002d: ldnull
IL_002e: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add<string>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>,
string,
!!0,
class [mscorlib]System.Func`2<!!0,string>)
IL_0033: nop
IL_0034: dup
IL_0035: ldstr "delimiter"
IL_003a: ldarga.s wireDelimiter
IL_003c: call instance string [mscorlib]System.Char::ToString()
IL_0041: ldnull
IL_0042: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add<string>(class [mscorlib]System.Collections.Generic.IList`1<valuetype [mscorlib]System.Collections.Generic.KeyValuePair`2<string,string>>,
string,
!!0,
class [mscorlib]System.Func`2<!!0,string>)
IL_0047: nop
IL_0048: stloc.0
IL_0049: ret
} // end of method TestCases::Issue1390
.method public hidebysig specialname rtspecialname .method public hidebysig specialname rtspecialname
instance void .ctor() cil managed instance void .ctor() cil managed
{ {
@ -4486,67 +4775,68 @@
.size 256 .size 256
} // end of class '__StaticArrayInitTypeSize=256' } // end of class '__StaticArrayInitTypeSize=256'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007044 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007480
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_0000708C .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_000074C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_0000709C .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_000074D8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_000070E4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_00007520
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_000070F4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_00007530
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007104 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007540
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007144 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007580
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_0000716C .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_000075A8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000071BC .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000075F8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000072BC .field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000076F8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_000072C4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_00007700
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_000072EC .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_00007728
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007314 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007750
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_0000732C .field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007768
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007334 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007770
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_00007364 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_000077A0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000073A4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000077E0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_000073CC .field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_00007808
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_000073D4 .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_00007810
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_000073FC .field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00007838
} // end of class '<PrivateImplementationDetails>' } // end of class '<PrivateImplementationDetails>'
// ============================================================= // =============================================================
.data cil I_00007044 = bytearray ( .data cil I_00007480 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00 09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00 0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00) 12 00 00 00 13 00 00 00)
.data cil I_0000708C = bytearray ( .data cil I_000074C8 = bytearray (
01 02 03 04 05 06 07 08 FE FF) 01 02 03 04 05 06 07 08 FE FF)
.data cil I_00007096 = int8[2] .data cil I_000074D2 = int8[6]
.data cil I_0000709C = bytearray ( .data cil I_000074D8 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00 15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00 19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!... 1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%... 22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'... 26 00 00 00 27 00 00 00) // &...'...
.data cil I_000070E4 = bytearray ( .data cil I_00007520 = bytearray (
00 80 FF FF 00 00 01 00 FF 7F) 00 80 FF FF 00 00 01 00 FF 7F)
.data cil I_000070EE = int8[2] .data cil I_0000752A = int8[6]
.data cil I_000070F4 = bytearray ( .data cil I_00007530 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF) 00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_00007104 = bytearray ( .data cil I_0000753C = int8[4]
.data cil I_00007540 = bytearray (
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_00007144 = bytearray ( .data cil I_00007580 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n.......... 01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_0000716C = bytearray ( .data cil I_000075A8 = bytearray (
01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w.... 01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^.............. 00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#.. FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_000071BC = bytearray ( .data cil I_000075F8 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4563,41 +4853,43 @@
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00)
.data cil I_000072BC = bytearray ( .data cil I_000076F8 = bytearray (
80 81 00 01 02 03 04 7F) 80 81 00 01 02 03 04 7F)
.data cil I_000072C4 = bytearray ( .data cil I_00007700 = bytearray (
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
01 00 00 00) 01 00 00 00)
.data cil I_000072EC = bytearray ( .data cil I_00007724 = int8[4]
.data cil I_00007728 = bytearray (
01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^...... 01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_00007314 = bytearray ( .data cil I_00007750 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00) 05 00 00 00 06 00 00 00)
.data cil I_0000732C = bytearray ( .data cil I_00007768 = bytearray (
00 01 02 FF) 00 01 02 FF)
.data cil I_00007334 = bytearray ( .data cil I_0000776C = int8[4]
.data cil I_00007770 = bytearray (
00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F8 BF 00 00 00 00 00 00 00 00
00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........ 00 00 00 00 00 00 F8 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF) 00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_00007364 = bytearray ( .data cil I_000077A0 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_000073A4 = bytearray ( .data cil I_000077E0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00 05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_000073CC = bytearray ( .data cil I_00007808 = bytearray (
01 00 01 00 00 00 01 01) 01 00 01 00 00 00 01 01)
.data cil I_000073D4 = bytearray ( .data cil I_00007810 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w.... 01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00 05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00) 09 00 00 00 0A 00 00 00)
.data cil I_000073FC = bytearray ( .data cil I_00007838 = bytearray (
00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?.... 00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?....
00 00 80 7F 00 00 C0 FF) 00 00 80 7F 00 00 C0 FF)
// *********** DISASSEMBLY COMPLETE *********************** // *********** DISASSEMBLY COMPLETE ***********************

49
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs

@ -715,6 +715,55 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Console.WriteLine("End of method"); Console.WriteLine("End of method");
} }
public void Issue1395(int count)
{
Environment.GetCommandLineArgs();
for (int i = 0; i < count; i++) {
Environment.GetCommandLineArgs();
do {
#if OPT || MCS
IL_0013:
#else
IL_0016:
#endif
Environment.GetCommandLineArgs();
if (Condition("part1")) {
Environment.GetEnvironmentVariables();
if (Condition("restart")) {
#if OPT || MCS
goto IL_0013;
#else
goto IL_0016;
#endif
}
} else {
Environment.GetLogicalDrives();
}
Environment.GetCommandLineArgs();
while (count > 0) {
switch (count) {
case 0:
case 1:
case 2:
Environment.GetCommandLineArgs();
break;
case 3:
case 5:
case 6:
Environment.GetEnvironmentVariables();
break;
default:
Environment.GetLogicalDrives();
break;
}
}
count++;
} while (Condition("do-while"));
Environment.GetCommandLineArgs();
}
Environment.GetCommandLineArgs();
}
public void ForLoop() public void ForLoop()
{ {
Console.WriteLine("Initial"); Console.WriteLine("Initial");

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

@ -2681,6 +2681,127 @@
IL_0098: ret IL_0098: ret
} // end of method Loops::DoWhileLoop } // end of method Loops::DoWhileLoop
.method public hidebysig instance void
Issue1395(int32 count) cil managed
{
// Code size 218 (0xda)
.maxstack 2
.locals init (int32 V_0,
bool V_1,
int32 V_2)
IL_0000: nop
IL_0001: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0006: pop
IL_0007: ldc.i4.0
IL_0008: stloc.0
IL_0009: br IL_00c8
IL_000e: nop
IL_000f: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0014: pop
IL_0015: nop
IL_0016: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_001b: pop
IL_001c: ldarg.0
IL_001d: ldstr "part1"
IL_0022: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0027: ldc.i4.0
IL_0028: ceq
IL_002a: stloc.1
IL_002b: ldloc.1
IL_002c: brtrue.s IL_004d
IL_002e: nop
IL_002f: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_0034: pop
IL_0035: ldarg.0
IL_0036: ldstr "restart"
IL_003b: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0040: ldc.i4.0
IL_0041: ceq
IL_0043: stloc.1
IL_0044: ldloc.1
IL_0045: brtrue.s IL_004a
IL_0047: nop
IL_0048: br.s IL_0016
IL_004a: nop
IL_004b: br.s IL_0055
IL_004d: nop
IL_004e: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_0053: pop
IL_0054: nop
IL_0055: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_005a: pop
IL_005b: br.s IL_009d
IL_005d: nop
IL_005e: ldarg.1
IL_005f: stloc.2
IL_0060: ldloc.2
IL_0061: switch (
IL_0084,
IL_0084,
IL_0084,
IL_008c,
IL_0094,
IL_008c,
IL_008c)
IL_0082: br.s IL_0094
IL_0084: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0089: pop
IL_008a: br.s IL_009c
IL_008c: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_0091: pop
IL_0092: br.s IL_009c
IL_0094: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_0099: pop
IL_009a: br.s IL_009c
IL_009c: nop
IL_009d: ldarg.1
IL_009e: ldc.i4.0
IL_009f: cgt
IL_00a1: stloc.1
IL_00a2: ldloc.1
IL_00a3: brtrue.s IL_005d
IL_00a5: ldarg.1
IL_00a6: ldc.i4.1
IL_00a7: add
IL_00a8: starg.s count
IL_00aa: nop
IL_00ab: ldarg.0
IL_00ac: ldstr "do-while"
IL_00b1: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_00b6: stloc.1
IL_00b7: ldloc.1
IL_00b8: brtrue IL_0015
IL_00bd: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00c2: pop
IL_00c3: nop
IL_00c4: ldloc.0
IL_00c5: ldc.i4.1
IL_00c6: add
IL_00c7: stloc.0
IL_00c8: ldloc.0
IL_00c9: ldarg.1
IL_00ca: clt
IL_00cc: stloc.1
IL_00cd: ldloc.1
IL_00ce: brtrue IL_000e
IL_00d3: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00d8: pop
IL_00d9: ret
} // end of method Loops::Issue1395
.method public hidebysig instance void .method public hidebysig instance void
ForLoop() cil managed ForLoop() cil managed
{ {

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

@ -1904,6 +1904,98 @@
IL_008c: ret IL_008c: ret
} // end of method Loops::DoWhileLoop } // end of method Loops::DoWhileLoop
.method public hidebysig instance void
Issue1395(int32 count) cil managed
{
// Code size 216 (0xd8)
.maxstack 19
.locals init (int32 V_0,
int32 V_1)
IL_0000: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0005: pop
IL_0006: ldc.i4.0
IL_0007: stloc.0
IL_0008: br IL_00ca
IL_000d: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0012: pop
IL_0013: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0018: pop
IL_0019: ldarg.0
IL_001a: ldstr "part1"
IL_001f: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0024: brfalse IL_0049
IL_0029: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_002e: pop
IL_002f: ldarg.0
IL_0030: ldstr "restart"
IL_0035: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_003a: brfalse IL_0044
IL_003f: br IL_0013
IL_0044: br IL_004f
IL_0049: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_004e: pop
IL_004f: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0054: pop
IL_0055: br IL_00a4
IL_005a: ldarg.1
IL_005b: stloc.1
IL_005c: ldloc.1
IL_005d: switch (
IL_0083,
IL_0083,
IL_0083,
IL_008e,
IL_0099,
IL_008e,
IL_008e)
IL_007e: br IL_0099
IL_0083: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0088: pop
IL_0089: br IL_00a4
IL_008e: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_0093: pop
IL_0094: br IL_00a4
IL_0099: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_009e: pop
IL_009f: br IL_00a4
IL_00a4: ldarg.1
IL_00a5: ldc.i4.0
IL_00a6: bgt IL_005a
IL_00ab: ldarg.1
IL_00ac: ldc.i4.1
IL_00ad: add
IL_00ae: starg.s count
IL_00b0: ldarg.0
IL_00b1: ldstr "do-while"
IL_00b6: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_00bb: brtrue IL_0013
IL_00c0: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00c5: pop
IL_00c6: ldloc.0
IL_00c7: ldc.i4.1
IL_00c8: add
IL_00c9: stloc.0
IL_00ca: ldloc.0
IL_00cb: ldarg.1
IL_00cc: blt IL_000d
IL_00d1: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00d6: pop
IL_00d7: ret
} // end of method Loops::Issue1395
.method public hidebysig instance void .method public hidebysig instance void
ForLoop() cil managed ForLoop() cil managed
{ {

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

@ -2067,6 +2067,94 @@
IL_0073: ret IL_0073: ret
} // end of method Loops::DoWhileLoop } // end of method Loops::DoWhileLoop
.method public hidebysig instance void
Issue1395(int32 count) cil managed
{
// Code size 182 (0xb6)
.maxstack 2
.locals init (int32 V_0,
int32 V_1)
IL_0000: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0005: pop
IL_0006: ldc.i4.0
IL_0007: stloc.0
IL_0008: br IL_00a8
IL_000d: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0012: pop
IL_0013: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0018: pop
IL_0019: ldarg.0
IL_001a: ldstr "part1"
IL_001f: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0024: brfalse.s IL_003b
IL_0026: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_002b: pop
IL_002c: ldarg.0
IL_002d: ldstr "restart"
IL_0032: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0037: brfalse.s IL_0041
IL_0039: br.s IL_0013
IL_003b: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_0040: pop
IL_0041: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0046: pop
IL_0047: br.s IL_0085
IL_0049: ldarg.1
IL_004a: stloc.1
IL_004b: ldloc.1
IL_004c: switch (
IL_006f,
IL_006f,
IL_006f,
IL_0077,
IL_007f,
IL_0077,
IL_0077)
IL_006d: br.s IL_007f
IL_006f: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0074: pop
IL_0075: br.s IL_0085
IL_0077: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_007c: pop
IL_007d: br.s IL_0085
IL_007f: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_0084: pop
IL_0085: ldarg.1
IL_0086: ldc.i4.0
IL_0087: bgt.s IL_0049
IL_0089: ldarg.1
IL_008a: ldc.i4.1
IL_008b: add
IL_008c: starg.s count
IL_008e: ldarg.0
IL_008f: ldstr "do-while"
IL_0094: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0099: brtrue IL_0013
IL_009e: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00a3: pop
IL_00a4: ldloc.0
IL_00a5: ldc.i4.1
IL_00a6: add
IL_00a7: stloc.0
IL_00a8: ldloc.0
IL_00a9: ldarg.1
IL_00aa: blt IL_000d
IL_00af: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00b4: pop
IL_00b5: ret
} // end of method Loops::Issue1395
.method public hidebysig instance void .method public hidebysig instance void
ForLoop() cil managed ForLoop() cil managed
{ {

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

@ -1904,6 +1904,98 @@
IL_008c: ret IL_008c: ret
} // end of method Loops::DoWhileLoop } // end of method Loops::DoWhileLoop
.method public hidebysig instance void
Issue1395(int32 count) cil managed
{
// Code size 216 (0xd8)
.maxstack 19
.locals init (int32 V_0,
int32 V_1)
IL_0000: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0005: pop
IL_0006: ldc.i4.0
IL_0007: stloc.0
IL_0008: br IL_00ca
IL_000d: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0012: pop
IL_0013: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0018: pop
IL_0019: ldarg.0
IL_001a: ldstr "part1"
IL_001f: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0024: brfalse IL_0049
IL_0029: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_002e: pop
IL_002f: ldarg.0
IL_0030: ldstr "restart"
IL_0035: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_003a: brfalse IL_0044
IL_003f: br IL_0013
IL_0044: br IL_004f
IL_0049: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_004e: pop
IL_004f: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0054: pop
IL_0055: br IL_00a4
IL_005a: ldarg.1
IL_005b: stloc.1
IL_005c: ldloc.1
IL_005d: switch (
IL_0083,
IL_0083,
IL_0083,
IL_008e,
IL_0099,
IL_008e,
IL_008e)
IL_007e: br IL_0099
IL_0083: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0088: pop
IL_0089: br IL_00a4
IL_008e: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_0093: pop
IL_0094: br IL_00a4
IL_0099: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_009e: pop
IL_009f: br IL_00a4
IL_00a4: ldarg.1
IL_00a5: ldc.i4.0
IL_00a6: bgt IL_005a
IL_00ab: ldarg.1
IL_00ac: ldc.i4.1
IL_00ad: add
IL_00ae: starg.s count
IL_00b0: ldarg.0
IL_00b1: ldstr "do-while"
IL_00b6: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_00bb: brtrue IL_0013
IL_00c0: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00c5: pop
IL_00c6: ldloc.0
IL_00c7: ldc.i4.1
IL_00c8: add
IL_00c9: stloc.0
IL_00ca: ldloc.0
IL_00cb: ldarg.1
IL_00cc: blt IL_000d
IL_00d1: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00d6: pop
IL_00d7: ret
} // end of method Loops::Issue1395
.method public hidebysig instance void .method public hidebysig instance void
ForLoop() cil managed ForLoop() cil managed
{ {

85
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il

@ -2011,6 +2011,91 @@
IL_0073: ret IL_0073: ret
} // end of method Loops::DoWhileLoop } // end of method Loops::DoWhileLoop
.method public hidebysig instance void
Issue1395(int32 count) cil managed
{
// Code size 180 (0xb4)
.maxstack 2
.locals init (int32 V_0)
IL_0000: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0005: pop
IL_0006: ldc.i4.0
IL_0007: stloc.0
IL_0008: br IL_00a6
IL_000d: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0012: pop
IL_0013: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0018: pop
IL_0019: ldarg.0
IL_001a: ldstr "part1"
IL_001f: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0024: brfalse.s IL_003b
IL_0026: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_002b: pop
IL_002c: ldarg.0
IL_002d: ldstr "restart"
IL_0032: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0037: brfalse.s IL_0041
IL_0039: br.s IL_0013
IL_003b: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_0040: pop
IL_0041: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0046: pop
IL_0047: br.s IL_0083
IL_0049: ldarg.1
IL_004a: switch (
IL_006d,
IL_006d,
IL_006d,
IL_0075,
IL_007d,
IL_0075,
IL_0075)
IL_006b: br.s IL_007d
IL_006d: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0072: pop
IL_0073: br.s IL_0083
IL_0075: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_007a: pop
IL_007b: br.s IL_0083
IL_007d: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_0082: pop
IL_0083: ldarg.1
IL_0084: ldc.i4.0
IL_0085: bgt.s IL_0049
IL_0087: ldarg.1
IL_0088: ldc.i4.1
IL_0089: add
IL_008a: starg.s count
IL_008c: ldarg.0
IL_008d: ldstr "do-while"
IL_0092: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0097: brtrue IL_0013
IL_009c: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00a1: pop
IL_00a2: ldloc.0
IL_00a3: ldc.i4.1
IL_00a4: add
IL_00a5: stloc.0
IL_00a6: ldloc.0
IL_00a7: ldarg.1
IL_00a8: blt IL_000d
IL_00ad: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00b2: pop
IL_00b3: ret
} // end of method Loops::Issue1395
.method public hidebysig instance void .method public hidebysig instance void
ForLoop() cil managed ForLoop() cil managed
{ {

122
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il

@ -2508,6 +2508,128 @@
IL_0094: ret IL_0094: ret
} // end of method Loops::DoWhileLoop } // end of method Loops::DoWhileLoop
.method public hidebysig instance void
Issue1395(int32 count) cil managed
{
// Code size 219 (0xdb)
.maxstack 2
.locals init (int32 V_0,
bool V_1,
bool V_2,
int32 V_3,
bool V_4,
bool V_5,
bool V_6)
IL_0000: nop
IL_0001: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0006: pop
IL_0007: ldc.i4.0
IL_0008: stloc.0
IL_0009: br IL_00c7
IL_000e: nop
IL_000f: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0014: pop
IL_0015: nop
IL_0016: nop
IL_0017: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_001c: pop
IL_001d: ldarg.0
IL_001e: ldstr "part1"
IL_0023: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_0028: stloc.1
IL_0029: ldloc.1
IL_002a: brfalse.s IL_0048
IL_002c: nop
IL_002d: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_0032: pop
IL_0033: ldarg.0
IL_0034: ldstr "restart"
IL_0039: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_003e: stloc.2
IL_003f: ldloc.2
IL_0040: brfalse.s IL_0045
IL_0042: nop
IL_0043: br.s IL_0016
IL_0045: nop
IL_0046: br.s IL_0050
IL_0048: nop
IL_0049: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_004e: pop
IL_004f: nop
IL_0050: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0055: pop
IL_0056: br.s IL_0098
IL_0058: nop
IL_0059: ldarg.1
IL_005a: stloc.3
IL_005b: ldloc.3
IL_005c: switch (
IL_007f,
IL_007f,
IL_007f,
IL_0087,
IL_008f,
IL_0087,
IL_0087)
IL_007d: br.s IL_008f
IL_007f: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_0084: pop
IL_0085: br.s IL_0097
IL_0087: call class [mscorlib]System.Collections.IDictionary [mscorlib]System.Environment::GetEnvironmentVariables()
IL_008c: pop
IL_008d: br.s IL_0097
IL_008f: call string[] [mscorlib]System.Environment::GetLogicalDrives()
IL_0094: pop
IL_0095: br.s IL_0097
IL_0097: nop
IL_0098: ldarg.1
IL_0099: ldc.i4.0
IL_009a: cgt
IL_009c: stloc.s V_4
IL_009e: ldloc.s V_4
IL_00a0: brtrue.s IL_0058
IL_00a2: ldarg.1
IL_00a3: ldc.i4.1
IL_00a4: add
IL_00a5: starg.s count
IL_00a7: nop
IL_00a8: ldarg.0
IL_00a9: ldstr "do-while"
IL_00ae: call instance bool ICSharpCode.Decompiler.Tests.TestCases.Pretty.Loops::Condition(string)
IL_00b3: stloc.s V_5
IL_00b5: ldloc.s V_5
IL_00b7: brtrue IL_0015
IL_00bc: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00c1: pop
IL_00c2: nop
IL_00c3: ldloc.0
IL_00c4: ldc.i4.1
IL_00c5: add
IL_00c6: stloc.0
IL_00c7: ldloc.0
IL_00c8: ldarg.1
IL_00c9: clt
IL_00cb: stloc.s V_6
IL_00cd: ldloc.s V_6
IL_00cf: brtrue IL_000e
IL_00d4: call string[] [mscorlib]System.Environment::GetCommandLineArgs()
IL_00d9: pop
IL_00da: ret
} // end of method Loops::Issue1395
.method public hidebysig instance void .method public hidebysig instance void
ForLoop() cil managed ForLoop() cil managed
{ {

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

@ -488,9 +488,17 @@ namespace ICSharpCode.Decompiler.Tests.TypeSystem
public void EnumFieldsTest() public void EnumFieldsTest()
{ {
var e = GetTypeDefinition(typeof(MyEnum)); var e = GetTypeDefinition(typeof(MyEnum));
IField[] fields = e.Fields.ToArray(); IField valueField = e.Fields.First();
IField[] fields = e.Fields.Skip(1).ToArray();
Assert.AreEqual(5, fields.Length); Assert.AreEqual(5, fields.Length);
Assert.AreEqual("value__", valueField.Name);
Assert.AreEqual(GetTypeDefinition(typeof(short)), valueField.Type);
Assert.AreEqual(Accessibility.Public, valueField.Accessibility);
Assert.AreEqual(null, valueField.GetConstantValue());
Assert.IsFalse(valueField.IsConst);
Assert.IsFalse(valueField.IsStatic);
foreach (IField f in fields) { foreach (IField f in fields) {
Assert.IsTrue(f.IsStatic); Assert.IsTrue(f.IsStatic);
Assert.IsTrue(f.IsConst); Assert.IsTrue(f.IsConst);

4
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -951,6 +951,8 @@ namespace ICSharpCode.Decompiler.CSharp
} }
foreach (var field in typeDef.Fields) { foreach (var field in typeDef.Fields) {
if (!field.MetadataToken.IsNil && !MemberIsHidden(module.PEFile, field.MetadataToken, settings)) { if (!field.MetadataToken.IsNil && !MemberIsHidden(module.PEFile, field.MetadataToken, settings)) {
if (typeDef.Kind == TypeKind.Enum && !field.IsConst)
continue;
var memberDecl = DoDecompile(field, decompileRun, decompilationContext.WithCurrentMember(field)); var memberDecl = DoDecompile(field, decompileRun, decompilationContext.WithCurrentMember(field));
typeDecl.Members.Add(memberDecl); typeDecl.Members.Add(memberDecl);
} }
@ -1262,7 +1264,7 @@ namespace ICSharpCode.Decompiler.CSharp
Debug.Assert(decompilationContext.CurrentMember == field); Debug.Assert(decompilationContext.CurrentMember == field);
try { try {
var typeSystemAstBuilder = CreateAstBuilder(decompilationContext); var typeSystemAstBuilder = CreateAstBuilder(decompilationContext);
if (decompilationContext.CurrentTypeDefinition.Kind == TypeKind.Enum) { if (decompilationContext.CurrentTypeDefinition.Kind == TypeKind.Enum && field.IsConst) {
var enumDec = new EnumMemberDeclaration { Name = field.Name }; var enumDec = new EnumMemberDeclaration { Name = field.Name };
object constantValue = field.GetConstantValue(); object constantValue = field.GetConstantValue();
if (constantValue != null) { if (constantValue != null) {

42
ICSharpCode.Decompiler/CSharp/CallBuilder.cs

@ -54,18 +54,19 @@ namespace ICSharpCode.Decompiler.CSharp
public bool IsExpandedForm; public bool IsExpandedForm;
public int Length => Arguments.Length; public int Length => Arguments.Length;
public IEnumerable<ResolveResult> GetArgumentResolveResults() public IEnumerable<ResolveResult> GetArgumentResolveResults(int skipCount = 0)
{ {
return FirstOptionalArgumentIndex < 0 return FirstOptionalArgumentIndex < 0
? Arguments.Select(a => a.ResolveResult) ? Arguments.Skip(skipCount).Select(a => a.ResolveResult)
: Arguments.Take(FirstOptionalArgumentIndex).Select(a => a.ResolveResult); : Arguments.Skip(skipCount).Take(FirstOptionalArgumentIndex).Select(a => a.ResolveResult);
} }
public IEnumerable<Expression> GetArgumentExpressions() public IEnumerable<Expression> GetArgumentExpressions(int skipCount = 0)
{ {
if (AddNamesToPrimitiveValues && IsPrimitiveValue.Any() && !IsExpandedForm if (AddNamesToPrimitiveValues && IsPrimitiveValue.Any() && !IsExpandedForm
&& !ParameterNames.Any(p => string.IsNullOrEmpty(p))) && !ParameterNames.Any(p => string.IsNullOrEmpty(p)))
{ {
Debug.Assert(skipCount == 0);
if (ArgumentNames == null) { if (ArgumentNames == null) {
ArgumentNames = new string[Arguments.Length]; ArgumentNames = new string[Arguments.Length];
} }
@ -78,9 +79,10 @@ namespace ICSharpCode.Decompiler.CSharp
} }
if (ArgumentNames == null) { if (ArgumentNames == null) {
if (FirstOptionalArgumentIndex < 0) if (FirstOptionalArgumentIndex < 0)
return Arguments.Select(arg => arg.Expression); return Arguments.Skip(skipCount).Select(arg => arg.Expression);
return Arguments.Take(FirstOptionalArgumentIndex).Select(arg => arg.Expression); return Arguments.Skip(skipCount).Take(FirstOptionalArgumentIndex).Select(arg => arg.Expression);
} else { } else {
Debug.Assert(skipCount == 0);
if (FirstOptionalArgumentIndex < 0) { if (FirstOptionalArgumentIndex < 0) {
return Arguments.Zip(ArgumentNames, return Arguments.Zip(ArgumentNames,
(arg, name) => { (arg, name) => {
@ -373,17 +375,15 @@ namespace ICSharpCode.Decompiler.CSharp
// sure that the correct method is called by resolving any ambiguities by inserting casts, if necessary. // sure that the correct method is called by resolving any ambiguities by inserting casts, if necessary.
ExpectedTargetDetails expectedTargetDetails = new ExpectedTargetDetails { CallOpCode = callOpCode }; ExpectedTargetDetails expectedTargetDetails = new ExpectedTargetDetails { CallOpCode = callOpCode };
var unused = new IdentifierExpression("initializedObject").WithRR(target).WithoutILInstruction();
// Special case: only in this case, collection initializers, are extension methods already transformed on var args = callArguments.ToList();
// ILAst level, therefore we have to exclude the first argument. if (method.IsExtensionMethod)
int firstParamIndex = method.IsExtensionMethod ? 1 : 0; args.Insert(0, new Nop());
var argumentList = BuildArgumentList(expectedTargetDetails, target, method, var argumentList = BuildArgumentList(expectedTargetDetails, target, method,
firstParamIndex, callArguments, null); firstParamIndex: 0, args, null);
argumentList.ArgumentNames = null; argumentList.ArgumentNames = null;
argumentList.AddNamesToPrimitiveValues = false; argumentList.AddNamesToPrimitiveValues = false;
var unused = new IdentifierExpression("initializedObject").WithRR(target).WithoutILInstruction();
var transform = GetRequiredTransformationsForCall(expectedTargetDetails, method, ref unused, var transform = GetRequiredTransformationsForCall(expectedTargetDetails, method, ref unused,
ref argumentList, CallTransformation.None, out IParameterizedMember foundMethod); ref argumentList, CallTransformation.None, out IParameterizedMember foundMethod);
Debug.Assert(transform == CallTransformation.None || transform == CallTransformation.NoOptionalArgumentAllowed); Debug.Assert(transform == CallTransformation.None || transform == CallTransformation.NoOptionalArgumentAllowed);
@ -391,14 +391,22 @@ namespace ICSharpCode.Decompiler.CSharp
// Calls with only one argument do not need an array initializer expression to wrap them. // Calls with only one argument do not need an array initializer expression to wrap them.
// Any special cases are handled by the caller (i.e., ExpressionBuilder.TranslateObjectAndCollectionInitializer) // Any special cases are handled by the caller (i.e., ExpressionBuilder.TranslateObjectAndCollectionInitializer)
// Note: we intentionally ignore the firstOptionalArgumentIndex in this case. // Note: we intentionally ignore the firstOptionalArgumentIndex in this case.
if (argumentList.Arguments.Length == 1) int skipCount;
return argumentList.Arguments[0]; if (method.IsExtensionMethod) {
if (argumentList.Arguments.Length == 2)
return argumentList.Arguments[1];
skipCount = 1;
} else {
if (argumentList.Arguments.Length == 1)
return argumentList.Arguments[0];
skipCount = 0;
}
if ((transform & CallTransformation.NoOptionalArgumentAllowed) != 0) if ((transform & CallTransformation.NoOptionalArgumentAllowed) != 0)
argumentList.FirstOptionalArgumentIndex = -1; argumentList.FirstOptionalArgumentIndex = -1;
return new ArrayInitializerExpression(argumentList.GetArgumentExpressions()) return new ArrayInitializerExpression(argumentList.GetArgumentExpressions(skipCount))
.WithRR(new CSharpInvocationResolveResult(target, method, argumentList.GetArgumentResolveResults().ToArray(), .WithRR(new CSharpInvocationResolveResult(target, method, argumentList.GetArgumentResolveResults(skipCount).ToArray(),
isExtensionMethodInvocation: method.IsExtensionMethod, isExpandedForm: argumentList.IsExpandedForm)); isExtensionMethodInvocation: method.IsExtensionMethod, isExpandedForm: argumentList.IsExpandedForm));
} }

10
ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

@ -858,12 +858,18 @@ namespace ICSharpCode.Decompiler.CSharp
if (!container.MatchConditionBlock(continueTarget, out condition, out _)) if (!container.MatchConditionBlock(continueTarget, out condition, out _))
throw new NotSupportedException("Invalid condition block in do-while loop."); throw new NotSupportedException("Invalid condition block in do-while loop.");
blockStatement = ConvertBlockContainer(new BlockStatement(), container, container.Blocks.SkipLast(1), true); blockStatement = ConvertBlockContainer(new BlockStatement(), container, container.Blocks.SkipLast(1), true);
if (continueTarget.IncomingEdgeCount == continueCount) { if (container.EntryPoint.IncomingEdgeCount == 2) {
// Remove the entrypoint label if all jumps to the label were replaced with 'continue;' statements // Remove the entry-point label, if there are only two jumps to the entry-point:
// from outside the loop and from the condition-block.
blockStatement.Statements.First().Remove(); blockStatement.Statements.First().Remove();
} }
if (blockStatement.LastOrDefault() is ContinueStatement continueStmt3) if (blockStatement.LastOrDefault() is ContinueStatement continueStmt3)
continueStmt3.Remove(); continueStmt3.Remove();
if (continueTarget.IncomingEdgeCount > continueCount) {
// if there are branches to the condition block, that were not converted
// to continue statements, we have to introduce an extra label.
blockStatement.Add(new LabelStatement { Label = continueTarget.Label });
}
if (blockStatement.Statements.Count == 0) { if (blockStatement.Statements.Count == 0) {
return new WhileStatement { return new WhileStatement {
Condition = exprBuilder.TranslateCondition(condition), Condition = exprBuilder.TranslateCondition(condition),

8
ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

@ -970,9 +970,11 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
IType mathType; IType mathType;
if (isDouble) if (isDouble)
mathType = compilation.FindType(typeof(Math)); mathType = compilation.FindType(typeof(Math));
else else {
mathType = compilation.FindType(new TopLevelTypeName("System", "MathF")).GetDefinition() mathType = compilation.FindType(new TopLevelTypeName("System", "MathF")).GetDefinition();
?? compilation.FindType(typeof(Math)); if (mathType == null || !mathType.GetFields(f => f.Name == "PI" && f.IsConst).Any() || !mathType.GetFields(f => f.Name == "E" && f.IsConst).Any())
mathType = compilation.FindType(typeof(Math));
}
expr = TryExtractExpression(mathType, type, constantValue, "PI", isDouble) expr = TryExtractExpression(mathType, type, constantValue, "PI", isDouble)
?? TryExtractExpression(mathType, type, constantValue, "E", isDouble); ?? TryExtractExpression(mathType, type, constantValue, "E", isDouble);

15
ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs

@ -123,6 +123,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
if (ctorMethodDef != null && ctorMethodDef.DeclaringType.IsReferenceType == false) if (ctorMethodDef != null && ctorMethodDef.DeclaringType.IsReferenceType == false)
return; return;
bool ctorIsUnsafe = instanceCtorsNotChainingWithThis.All(c => c.HasModifier(Modifiers.Unsafe));
// Recognize field or property initializers: // Recognize field or property initializers:
// Translate first statement in all ctors (if all ctors have the same statement) into an initializer. // Translate first statement in all ctors (if all ctors have the same statement) into an initializer.
bool allSame; bool allSame;
@ -133,7 +135,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
IMember fieldOrPropertyOrEvent = (m.Get<AstNode>("fieldAccess").Single().GetSymbol() as IMember)?.MemberDefinition; IMember fieldOrPropertyOrEvent = (m.Get<AstNode>("fieldAccess").Single().GetSymbol() as IMember)?.MemberDefinition;
if (!(fieldOrPropertyOrEvent is IField) && !(fieldOrPropertyOrEvent is IProperty) && !(fieldOrPropertyOrEvent is IEvent)) if (!(fieldOrPropertyOrEvent is IField) && !(fieldOrPropertyOrEvent is IProperty) && !(fieldOrPropertyOrEvent is IEvent))
break; break;
AstNode fieldOrPropertyOrEventDecl = members.FirstOrDefault(f => f.GetSymbol() == fieldOrPropertyOrEvent); var fieldOrPropertyOrEventDecl = members.FirstOrDefault(f => f.GetSymbol() == fieldOrPropertyOrEvent) as EntityDeclaration;
// Cannot transform if member is not found or if it is a custom event. // Cannot transform if member is not found or if it is a custom event.
if (fieldOrPropertyOrEventDecl == null || fieldOrPropertyOrEventDecl is CustomEventDeclaration) if (fieldOrPropertyOrEventDecl == null || fieldOrPropertyOrEventDecl is CustomEventDeclaration)
break; break;
@ -158,6 +160,9 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
if (allSame) { if (allSame) {
foreach (var ctor in instanceCtorsNotChainingWithThis) foreach (var ctor in instanceCtorsNotChainingWithThis)
ctor.Body.First().Remove(); ctor.Body.First().Remove();
if (ctorIsUnsafe && IntroduceUnsafeModifier.IsUnsafe(initializer)) {
fieldOrPropertyOrEventDecl.Modifiers |= Modifiers.Unsafe;
}
if (fieldOrPropertyOrEventDecl is PropertyDeclaration pd) { if (fieldOrPropertyOrEventDecl is PropertyDeclaration pd) {
pd.Initializer = initializer.Detach(); pd.Initializer = initializer.Detach();
} else { } else {
@ -175,6 +180,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
if (instanceCtors.Length == 1 && (members.Skip(1).Any() || instanceCtors[0].Parent is TypeDeclaration)) { if (instanceCtors.Length == 1 && (members.Skip(1).Any() || instanceCtors[0].Parent is TypeDeclaration)) {
ConstructorDeclaration emptyCtor = new ConstructorDeclaration(); ConstructorDeclaration emptyCtor = new ConstructorDeclaration();
emptyCtor.Modifiers = contextTypeDefinition.IsAbstract ? Modifiers.Protected : Modifiers.Public; emptyCtor.Modifiers = contextTypeDefinition.IsAbstract ? Modifiers.Protected : Modifiers.Public;
if (instanceCtors[0].HasModifier(Modifiers.Unsafe))
emptyCtor.Modifiers |= Modifiers.Unsafe;
emptyCtor.Body = new BlockStatement(); emptyCtor.Body = new BlockStatement();
if (emptyCtor.IsMatch(instanceCtors[0])) if (emptyCtor.IsMatch(instanceCtors[0]))
instanceCtors[0].Remove(); instanceCtors[0].Remove();
@ -186,6 +193,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
// Translate static constructor into field initializers if the class is BeforeFieldInit // Translate static constructor into field initializers if the class is BeforeFieldInit
var staticCtor = members.OfType<ConstructorDeclaration>().FirstOrDefault(c => (c.Modifiers & Modifiers.Static) == Modifiers.Static); var staticCtor = members.OfType<ConstructorDeclaration>().FirstOrDefault(c => (c.Modifiers & Modifiers.Static) == Modifiers.Static);
if (staticCtor != null) { if (staticCtor != null) {
bool ctorIsUnsafe = staticCtor.HasModifier(Modifiers.Unsafe);
IMethod ctorMethod = staticCtor.GetSymbol() as IMethod; IMethod ctorMethod = staticCtor.GetSymbol() as IMethod;
if (!ctorMethod.MetadataToken.IsNil) { if (!ctorMethod.MetadataToken.IsNil) {
var metadata = context.TypeSystem.MainModule.PEFile.Metadata; var metadata = context.TypeSystem.MainModule.PEFile.Metadata;
@ -202,9 +210,12 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
IMember fieldOrProperty = (assignment.Left.GetSymbol() as IMember)?.MemberDefinition; IMember fieldOrProperty = (assignment.Left.GetSymbol() as IMember)?.MemberDefinition;
if (!(fieldOrProperty is IField || fieldOrProperty is IProperty) || !fieldOrProperty.IsStatic) if (!(fieldOrProperty is IField || fieldOrProperty is IProperty) || !fieldOrProperty.IsStatic)
break; break;
AstNode fieldOrPropertyDecl = members.FirstOrDefault(f => f.GetSymbol() == fieldOrProperty); var fieldOrPropertyDecl = members.FirstOrDefault(f => f.GetSymbol() == fieldOrProperty) as EntityDeclaration;
if (fieldOrPropertyDecl == null) if (fieldOrPropertyDecl == null)
break; break;
if (ctorIsUnsafe && IntroduceUnsafeModifier.IsUnsafe(assignment.Right)) {
fieldOrPropertyDecl.Modifiers |= Modifiers.Unsafe;
}
if (fieldOrPropertyDecl is FieldDeclaration fd) if (fieldOrPropertyDecl is FieldDeclaration fd)
fd.Variables.Single().Initializer = assignment.Right.Detach(); fd.Variables.Single().Initializer = assignment.Right.Detach();
else if (fieldOrPropertyDecl is PropertyDeclaration pd) else if (fieldOrPropertyDecl is PropertyDeclaration pd)

5
ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUnsafeModifier.cs

@ -30,6 +30,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
compilationUnit.AcceptVisitor(this); compilationUnit.AcceptVisitor(this);
} }
public static bool IsUnsafe(AstNode node)
{
return node.AcceptVisitor(new IntroduceUnsafeModifier());
}
protected override bool VisitChildren(AstNode node) protected override bool VisitChildren(AstNode node)
{ {
bool result = false; bool result = false;

2
ICSharpCode.Decompiler/IL/ControlFlow/YieldReturnDecompiler.cs

@ -649,7 +649,7 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
private BlockContainer ConvertBody(BlockContainer oldBody, StateRangeAnalysis rangeAnalysis) private BlockContainer ConvertBody(BlockContainer oldBody, StateRangeAnalysis rangeAnalysis)
{ {
var blockStateMap = rangeAnalysis.GetBlockStateSetMapping(oldBody); var blockStateMap = rangeAnalysis.GetBlockStateSetMapping(oldBody);
BlockContainer newBody = new BlockContainer(); BlockContainer newBody = new BlockContainer() { ILRange = oldBody.ILRange };
// create all new blocks so that they can be referenced by gotos // create all new blocks so that they can be referenced by gotos
for (int blockIndex = 0; blockIndex < oldBody.Blocks.Count; blockIndex++) { for (int blockIndex = 0; blockIndex < oldBody.Blocks.Count; blockIndex++) {
newBody.Blocks.Add(new Block { ILRange = oldBody.Blocks[blockIndex].ILRange }); newBody.Blocks.Add(new Block { ILRange = oldBody.Blocks[blockIndex].ILRange });

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

@ -116,7 +116,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
return false; return false;
context.Step("CachedDelegateInitializationWithLocal", inst); context.Step("CachedDelegateInitializationWithLocal", inst);
((Block)otherStore.Parent).Instructions.Remove(otherStore); ((Block)otherStore.Parent).Instructions.Remove(otherStore);
inst.ReplaceWith(new StLoc(v, value)); inst.ReplaceWith(storeInst);
return true; return true;
} }

8
ICSharpCode.Decompiler/IL/Transforms/HighLevelLoopTransform.cs

@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
ConditionDetection.InvertIf(loopBody, ifInstruction, context); ConditionDetection.InvertIf(loopBody, ifInstruction, context);
} }
context.Step("Transform to while (condition) loop", loop); context.Step("Transform to while (condition) loop: " + loop.EntryPoint.Label, loop);
loop.Kind = ContainerKind.While; loop.Kind = ContainerKind.While;
//invert comparison //invert comparison
ifInstruction.Condition = Comp.LogicNot(ifInstruction.Condition); ifInstruction.Condition = Comp.LogicNot(ifInstruction.Condition);
@ -150,7 +150,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// not a do-while loop, exit. // not a do-while loop, exit.
if (conditions == null || conditions.Count == 0) if (conditions == null || conditions.Count == 0)
return false; return false;
context.Step("Transform to do-while loop", loop); context.Step("Transform to do-while loop: " + loop.EntryPoint.Label, loop);
Block conditionBlock; Block conditionBlock;
// first we remove all extracted instructions from the original block. // first we remove all extracted instructions from the original block.
var originalBlock = (Block)exit.Parent; var originalBlock = (Block)exit.Parent;
@ -358,7 +358,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// - increment block // - increment block
if (incrementBlock.Instructions.Count <= 1 || loop.Blocks.Count < 3) if (incrementBlock.Instructions.Count <= 1 || loop.Blocks.Count < 3)
return false; return false;
context.Step("Transform to for loop", loop); context.Step("Transform to for loop: " + loop.EntryPoint.Label, loop);
// move the block to the end of the loop: // move the block to the end of the loop:
loop.Blocks.MoveElementToEnd(incrementBlock); loop.Blocks.MoveElementToEnd(incrementBlock);
loop.Kind = ContainerKind.For; loop.Kind = ContainerKind.For;
@ -398,7 +398,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
} }
if (numberOfConditions == 0) if (numberOfConditions == 0)
return false; return false;
context.Step("Transform to for loop", loop); context.Step("Transform to for loop: " + loop.EntryPoint.Label, loop);
// split condition block: // split condition block:
whileCondition.ReplaceWith(forCondition); whileCondition.ReplaceWith(forCondition);
ExpressionTransforms.RunOnSingleStatement(forCondition, context); ExpressionTransforms.RunOnSingleStatement(forCondition, context);

11
ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs

@ -52,14 +52,21 @@ namespace ICSharpCode.Decompiler.IL.Transforms
public void Run(Block block, int pos, StatementTransformContext context) public void Run(Block block, int pos, StatementTransformContext context)
{ {
InlineOneIfPossible(block, pos, OptionsForBlock(block), context: context); InlineOneIfPossible(block, pos, OptionsForBlock(block, pos), context: context);
} }
internal static InliningOptions OptionsForBlock(Block block) internal static InliningOptions OptionsForBlock(Block block, int pos)
{ {
InliningOptions options = InliningOptions.None; InliningOptions options = InliningOptions.None;
if (IsCatchWhenBlock(block)) if (IsCatchWhenBlock(block))
options |= InliningOptions.Aggressive; options |= InliningOptions.Aggressive;
else {
var function = block.Ancestors.OfType<ILFunction>().FirstOrDefault();
var inst = block.Instructions[pos];
int? ctorCallStart = null;
if (IsInConstructorInitializer(function, inst, ref ctorCallStart))
options |= InliningOptions.Aggressive;
}
return options; return options;
} }

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

@ -103,7 +103,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
{ {
if (!context.Settings.NamedArguments) if (!context.Settings.NamedArguments)
return; return;
var options = ILInlining.OptionsForBlock(block); var options = ILInlining.OptionsForBlock(block, pos);
options |= InliningOptions.IntroduceNamedArguments; options |= InliningOptions.IntroduceNamedArguments;
ILInlining.InlineOneIfPossible(block, pos, options, context: context); ILInlining.InlineOneIfPossible(block, pos, options, context: context);
} }

13
ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs

@ -315,20 +315,23 @@ namespace ICSharpCode.Decompiler.IL.Transforms
nextIndices[k] = new LdcI4(nextMinimumIndex[k]); nextIndices[k] = new LdcI4(nextMinimumIndex[k]);
} }
} else { } else {
bool previousComponentWasGreater = false;
for (int k = 0; k < indices.Count; k++) { for (int k = 0; k < indices.Count; k++) {
if (!indices[k].MatchLdcI4(out int index)) if (!indices[k].MatchLdcI4(out int index))
return nextIndices; return null;
// index must be in range [0..length[ and must be greater than or equal to nextMinimumIndex // index must be in range [0..length[ and must be greater than or equal to nextMinimumIndex
// to avoid running out of bounds or accidentally reordering instructions or overwriting previous instructions. // to avoid running out of bounds or accidentally reordering instructions or overwriting previous instructions.
// However, leaving array slots empty is allowed, as those are filled with default values when the // However, leaving array slots empty is allowed, as those are filled with default values when the
// initializer block is generated. // initializer block is generated.
if (index < 0 || index >= arrayLength[k] || index < nextMinimumIndex[k]) if (index < 0 || index >= arrayLength[k] || (!previousComponentWasGreater && index < nextMinimumIndex[k]))
return null; return null;
nextIndices[k] = new LdcI4(nextMinimumIndex[k]);
if (index != nextMinimumIndex[k]) { if (index != nextMinimumIndex[k]) {
exactMatch = false; exactMatch = false;
nextIndices[k] = new LdcI4(nextMinimumIndex[k]); // this flag allows us to check whether the whole set of indices is smaller:
} else { // [3, 3] should be smaller than [4, 0] even though 3 > 0.
nextIndices[k] = indices[k]; if (index > nextMinimumIndex[k])
previousComponentWasGreater = true;
} }
} }
} }

4
ICSharpCode.Decompiler/TypeSystem/DecompilerTypeSystem.cs

@ -205,10 +205,10 @@ namespace ICSharpCode.Decompiler.TypeSystem
bool HasType(KnownTypeCode code) bool HasType(KnownTypeCode code)
{ {
TopLevelTypeName name = KnownTypeReference.Get(code).TypeName; TopLevelTypeName name = KnownTypeReference.Get(code).TypeName;
if (mainModule.GetTypeDefinition(name) != null) if (!mainModule.GetTypeDefinition(name).IsNil)
return true; return true;
foreach (var file in referencedAssemblies) { foreach (var file in referencedAssemblies) {
if (file.GetTypeDefinition(name) != null) if (!file.GetTypeDefinition(name).IsNil)
return true; return true;
} }
return false; return false;

2
ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs

@ -162,7 +162,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
foreach (FieldDefinitionHandle h in fieldCollection) { foreach (FieldDefinitionHandle h in fieldCollection) {
var field = metadata.GetFieldDefinition(h); var field = metadata.GetFieldDefinition(h);
var attr = field.Attributes; var attr = field.Attributes;
if (module.IsVisible(attr) && (attr & FieldAttributes.SpecialName) == 0) { if (module.IsVisible(attr)) {
fieldList.Add(module.GetDefinition(h)); fieldList.Add(module.GetDefinition(h));
} }
} }

3
ILSpy.AddIn/Commands/OpenCodeItemCommand.cs

@ -18,6 +18,7 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
public OpenCodeItemCommand(ILSpyAddInPackage owner) public OpenCodeItemCommand(ILSpyAddInPackage owner)
: base(owner, PkgCmdIDList.cmdidOpenCodeItemInILSpy) : base(owner, PkgCmdIDList.cmdidOpenCodeItemInILSpy)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
} }
protected override void OnBeforeQueryStatus(object sender, EventArgs e) protected override void OnBeforeQueryStatus(object sender, EventArgs e)
@ -185,6 +186,8 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
internal static void Register(ILSpyAddInPackage owner) internal static void Register(ILSpyAddInPackage owner)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
instance = new OpenCodeItemCommand(owner); instance = new OpenCodeItemCommand(owner);
} }
} }

9
ILSpy.AddIn/Commands/OpenILSpyCommand.cs

@ -6,9 +6,9 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using EnvDTE80;
using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell;
using Mono.Cecil; using Mono.Cecil;
using DTEConstants = EnvDTE.Constants;
namespace ICSharpCode.ILSpy.AddIn.Commands namespace ICSharpCode.ILSpy.AddIn.Commands
{ {
@ -32,6 +32,8 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
protected ILSpyCommand(ILSpyAddInPackage owner, uint id) protected ILSpyCommand(ILSpyAddInPackage owner, uint id)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
this.owner = owner; this.owner = owner;
CommandID menuCommandID = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)id); CommandID menuCommandID = new CommandID(GuidList.guidILSpyAddInCmdSet, (int)id);
OleMenuCommand menuItem = new OleMenuCommand(OnExecute, menuCommandID); OleMenuCommand menuItem = new OleMenuCommand(OnExecute, menuCommandID);
@ -96,7 +98,7 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
protected EnvDTE.Project FindProject(IEnumerable<EnvDTE.Project> projects, string projectFile) protected EnvDTE.Project FindProject(IEnumerable<EnvDTE.Project> projects, string projectFile)
{ {
foreach (var project in projects) { foreach (var project in projects) {
if (project.Kind == ProjectKinds.vsProjectKindSolutionFolder) { if (project.Kind == DTEConstants.vsProjectKindSolutionItems) {
// This is a solution folder -> search in sub-projects // This is a solution folder -> search in sub-projects
var subProject = FindProject( var subProject = FindProject(
project.ProjectItems.OfType<EnvDTE.ProjectItem>().Select(pi => pi.SubProject).OfType<EnvDTE.Project>(), project.ProjectItems.OfType<EnvDTE.ProjectItem>().Select(pi => pi.SubProject).OfType<EnvDTE.Project>(),
@ -120,6 +122,7 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
public OpenILSpyCommand(ILSpyAddInPackage owner) public OpenILSpyCommand(ILSpyAddInPackage owner)
: base(owner, PkgCmdIDList.cmdidOpenILSpy) : base(owner, PkgCmdIDList.cmdidOpenILSpy)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
} }
protected override void OnExecute(object sender, EventArgs e) protected override void OnExecute(object sender, EventArgs e)
@ -129,6 +132,8 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
internal static void Register(ILSpyAddInPackage owner) internal static void Register(ILSpyAddInPackage owner)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
instance = new OpenILSpyCommand(owner); instance = new OpenILSpyCommand(owner);
} }
} }

3
ILSpy.AddIn/Commands/OpenProjectOutputCommand.cs

@ -12,6 +12,7 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
public OpenProjectOutputCommand(ILSpyAddInPackage owner) public OpenProjectOutputCommand(ILSpyAddInPackage owner)
: base(owner, PkgCmdIDList.cmdidOpenProjectOutputInILSpy) : base(owner, PkgCmdIDList.cmdidOpenProjectOutputInILSpy)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
} }
protected override void OnBeforeQueryStatus(object sender, EventArgs e) protected override void OnBeforeQueryStatus(object sender, EventArgs e)
@ -36,6 +37,8 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
internal static void Register(ILSpyAddInPackage owner) internal static void Register(ILSpyAddInPackage owner)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
instance = new OpenProjectOutputCommand(owner); instance = new OpenProjectOutputCommand(owner);
} }
} }

3
ILSpy.AddIn/Commands/OpenReferenceCommand.cs

@ -17,6 +17,7 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
public OpenReferenceCommand(ILSpyAddInPackage owner) public OpenReferenceCommand(ILSpyAddInPackage owner)
: base(owner, PkgCmdIDList.cmdidOpenReferenceInILSpy) : base(owner, PkgCmdIDList.cmdidOpenReferenceInILSpy)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
} }
protected override void OnBeforeQueryStatus(object sender, EventArgs e) protected override void OnBeforeQueryStatus(object sender, EventArgs e)
@ -87,6 +88,8 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
internal static void Register(ILSpyAddInPackage owner) internal static void Register(ILSpyAddInPackage owner)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
instance = new OpenReferenceCommand(owner); instance = new OpenReferenceCommand(owner);
} }
} }

41
ILSpy.AddIn/ILSpy.AddIn.csproj

@ -51,9 +51,11 @@
<PackageReference Include="Microsoft.VisualStudio.ComponentModelHost" Version="15.6.27413" /> <PackageReference Include="Microsoft.VisualStudio.ComponentModelHost" Version="15.6.27413" />
<PackageReference Include="Microsoft.VisualStudio.Editor" Version="15.6.27740" /> <PackageReference Include="Microsoft.VisualStudio.Editor" Version="15.6.27740" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="2.4.0" /> <PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="2.4.0" />
<PackageReference Include="Microsoft.VisualStudio.Shell.14.0" Version="14.3.25407" /> <PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="15.6.27413" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime" Version="14.3.26929" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI" Version="15.6.27740" /> <PackageReference Include="Microsoft.VisualStudio.Text.UI" Version="15.6.27740" />
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="15.6.27740" /> <PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="15.6.27740" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="15.6.56" />
<PackageReference Include="Mono.Cecil" Version="0.10.1" /> <PackageReference Include="Mono.Cecil" Version="0.10.1" />
<PackageReference Include="VSLangProj" Version="7.0.3301" /> <PackageReference Include="VSLangProj" Version="7.0.3301" />
</ItemGroup> </ItemGroup>
@ -101,12 +103,41 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<!--
BEGIN WORKAROUND:
Nuget packages do not get added to the vsix automatically.
(related to https://github.com/icsharpcode/ILSpy/issues/511)
-->
<PropertyGroup>
<ILSpyBuildPath>..\ILSpy\bin\$(Configuration)\$(TargetFramework)\</ILSpyBuildPath>
</PropertyGroup>
<ItemGroup>
<AdditionalDependencies Include="$(ILSpyBuildPath)System.ValueTuple.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Collections.Immutable.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Composition.AttributedModel.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Composition.Convention.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Composition.Hosting.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Composition.Runtime.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Composition.TypedParts.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Threading.Tasks.Dataflow.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)ICSharpCode.AvalonEdit.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Humanizer.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)System.Reflection.Metadata.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Microsoft.VisualStudio.Composition.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Microsoft.VisualStudio.Validation.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Mono.Cecil.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)Mono.Cecil.Pdb.dll" />
<AdditionalDependencies Include="$(ILSpyBuildPath)ILSpy.BamlDecompiler.Plugin.dll" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Packages/*"> <Content Include="@(AdditionalDependencies)">
<IncludeInVSIX>true</IncludeInVSIX> <IncludeInVSIX>true</IncludeInVSIX>
<VSIXSubPath>\</VSIXSubPath> <VSIXSubPath>\</VSIXSubPath>
</Content> </Content>
</ItemGroup> </ItemGroup>
<!-- END WORKAROUND -->
<ItemGroup> <ItemGroup>
<None Include="ILSpyAddIn.vsct" /> <None Include="ILSpyAddIn.vsct" />
@ -160,8 +191,4 @@
<ProjectReference Update="@(ProjectReference)" Name="%(Filename)" /> <ProjectReference Update="@(ProjectReference)" Name="%(Filename)" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Packages\" />
</ItemGroup>
</Project> </Project>

36
ILSpy.AddIn/ILSpyAddInPackage.cs

@ -3,6 +3,8 @@ using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.ComponentModel.Design; using System.ComponentModel.Design;
using System.Threading;
using Microsoft;
using Microsoft.VisualStudio; using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell;
@ -11,6 +13,7 @@ using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices; using Microsoft.VisualStudio.LanguageServices;
using EnvDTE; using EnvDTE;
using System.Collections.Generic; using System.Collections.Generic;
using Task = System.Threading.Tasks.Task;
namespace ICSharpCode.ILSpy.AddIn namespace ICSharpCode.ILSpy.AddIn
{ {
@ -26,15 +29,15 @@ namespace ICSharpCode.ILSpy.AddIn
/// </summary> /// </summary>
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is // This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
// a package. // a package.
[PackageRegistration(UseManagedResourcesOnly = true)] [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
// This attribute is used to register the information needed to show this package // This attribute is used to register the information needed to show this package
// in the Help/About dialog of Visual Studio. // in the Help/About dialog of Visual Studio.
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
// This attribute is needed to let the shell know that this package exposes some menus. // This attribute is needed to let the shell know that this package exposes some menus.
[ProvideMenuResource("Menus.ctmenu", 1)] [ProvideMenuResource("Menus.ctmenu", 1)]
[Guid(GuidList.guidILSpyAddInPkgString)] [Guid(GuidList.guidILSpyAddInPkgString)]
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string)] [ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string, PackageAutoLoadFlags.BackgroundLoad)]
public sealed class ILSpyAddInPackage : Package public sealed class ILSpyAddInPackage : AsyncPackage
{ {
/// <summary> /// <summary>
/// Default constructor of the package. /// Default constructor of the package.
@ -65,19 +68,24 @@ namespace ICSharpCode.ILSpy.AddIn
/// Initialization of the package; this method is called right after the package is sited, so this is the place /// Initialization of the package; this method is called right after the package is sited, so this is the place
/// where you can put all the initialization code that rely on services provided by VisualStudio. /// where you can put all the initialization code that rely on services provided by VisualStudio.
/// </summary> /// </summary>
protected override void Initialize() protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{ {
Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); Debug.WriteLine($"Entering {nameof(InitializeAsync)}() of: {this}");
base.Initialize();
await base.InitializeAsync(cancellationToken, progress);
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
var componentModel = (IComponentModel)await GetServiceAsync(typeof(SComponentModel));
Assumes.Present(componentModel);
// Add our command handlers for menu (commands must exist in the .vsct file) // Add our command handlers for menu (commands must exist in the .vsct file)
this.menuService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; this.menuService = (OleMenuCommandService)await GetServiceAsync(typeof(IMenuCommandService));
Assumes.Present(menuService);
var componentModel = (IComponentModel)this.GetService(typeof(SComponentModel));
this.workspace = componentModel.GetService<VisualStudioWorkspace>(); this.workspace = componentModel.GetService<VisualStudioWorkspace>();
Assumes.Present(workspace);
if (menuService == null || workspace == null)
return;
OpenILSpyCommand.Register(this); OpenILSpyCommand.Register(this);
OpenProjectOutputCommand.Register(this); OpenProjectOutputCommand.Register(this);
@ -88,16 +96,22 @@ namespace ICSharpCode.ILSpy.AddIn
public void ShowMessage(string format, params object[] items) public void ShowMessage(string format, params object[] items)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
ShowMessage(OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, OLEMSGICON.OLEMSGICON_INFO, format, items); ShowMessage(OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, OLEMSGICON.OLEMSGICON_INFO, format, items);
} }
public void ShowMessage(OLEMSGICON icon, string format, params object[] items) public void ShowMessage(OLEMSGICON icon, string format, params object[] items)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
ShowMessage(OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, icon, format, items); ShowMessage(OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, icon, format, items);
} }
public int ShowMessage(OLEMSGBUTTON buttons, OLEMSGDEFBUTTON defaultButton, OLEMSGICON icon, string format, params object[] items) public int ShowMessage(OLEMSGBUTTON buttons, OLEMSGDEFBUTTON defaultButton, OLEMSGICON icon, string format, params object[] items)
{ {
ThreadHelper.ThrowIfNotOnUIThread();
IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell));
Guid clsid = Guid.Empty; Guid clsid = Guid.Empty;
int result; int result;

10
ILSpy.AddIn/ILSpyInstance.cs

@ -22,13 +22,9 @@ namespace ICSharpCode.ILSpy.AddIn
class ILSpyInstance class ILSpyInstance
{ {
ILSpyParameters parameters; readonly ILSpyParameters parameters;
public ILSpyInstance() public ILSpyInstance(ILSpyParameters parameters = null)
{
}
public ILSpyInstance(ILSpyParameters parameters)
{ {
this.parameters = parameters; this.parameters = parameters;
} }
@ -41,7 +37,7 @@ namespace ICSharpCode.ILSpy.AddIn
public void Start() public void Start()
{ {
var commandLineArguments = parameters.AssemblyFileNames?.Concat(parameters.Arguments); var commandLineArguments = parameters?.AssemblyFileNames?.Concat(parameters.Arguments);
var process = new Process() { var process = new Process() {
StartInfo = new ProcessStartInfo() { StartInfo = new ProcessStartInfo() {

4
ILSpy.AddIn/source.extension.vsixmanifest.template

@ -9,10 +9,6 @@
<Icon>ILSpy-Large.ico</Icon> <Icon>ILSpy-Large.ico</Icon>
</Metadata> </Metadata>
<Installation> <Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Ultimate" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Premium" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[15.0,17.0)" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,17.0)" /> <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,17.0)" />
</Installation> </Installation>
<Dependencies> <Dependencies>

14
ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net46</TargetFramework> <TargetFramework>net46</TargetFramework>
@ -7,11 +7,9 @@
<GenerateAssemblyInfo>False</GenerateAssemblyInfo> <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<EnableDefaultItems>false</EnableDefaultItems> <EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup> <ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
<ExtrasEnableDefaultPageItems>false</ExtrasEnableDefaultPageItems>
<PropertyGroup> <ExtrasEnableDefaultResourceItems>false</ExtrasEnableDefaultResourceItems>
<!-- Workaround for lack of XAML support in the new project system -->
<LanguageTargets>$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
@ -99,8 +97,4 @@
<None Include="app.config" /> <None Include="app.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project> </Project>

5
ILSpy.sln

@ -25,10 +25,13 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.BamlDecompiler.Tests", "ILSpy.BamlDecompiler.Tests\ILSpy.BamlDecompiler.Tests.csproj", "{1169E6D1-1899-43D4-A500-07CE4235B388}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.BamlDecompiler.Tests", "ILSpy.BamlDecompiler.Tests\ILSpy.BamlDecompiler.Tests.csproj", "{1169E6D1-1899-43D4-A500-07CE4235B388}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.AddIn", "ILSpy.AddIn\ILSpy.AddIn.csproj", "{9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.AddIn", "ILSpy.AddIn\ILSpy.AddIn.csproj", "{9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}"
ProjectSection(ProjectDependencies) = postProject
{A6BAD2BA-76BA-461C-8B6D-418607591247} = {A6BAD2BA-76BA-461C-8B6D-418607591247}
EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICSharpCode.Decompiler.PdbProvider.Cecil", "ICSharpCode.Decompiler.PdbProvider.Cecil\ICSharpCode.Decompiler.PdbProvider.Cecil.csproj", "{B85A155A-9DD6-43BC-A624-2D8EC773D71F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICSharpCode.Decompiler.PdbProvider.Cecil", "ICSharpCode.Decompiler.PdbProvider.Cecil\ICSharpCode.Decompiler.PdbProvider.Cecil.csproj", "{B85A155A-9DD6-43BC-A624-2D8EC773D71F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.Tests", "ILSpy.Tests\ILSpy.Tests.csproj", "{B51C6636-B8D1-4200-9869-08F2689DE6C2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.Tests", "ILSpy.Tests\ILSpy.Tests.csproj", "{B51C6636-B8D1-4200-9869-08F2689DE6C2}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

2
ILSpy/FilterSettings.cs

@ -36,7 +36,7 @@ namespace ICSharpCode.ILSpy
{ {
public FilterSettings(XElement element) public FilterSettings(XElement element)
{ {
this.ShowApiLevel = (ApiVisibility?)(int?)element.Element("ShowAPILevel") ?? ApiVisibility.PublicOnly; this.ShowApiLevel = (ApiVisibility?)(int?)element.Element("ShowAPILevel") ?? ApiVisibility.PublicAndInternal;
this.Language = Languages.GetLanguage((string)element.Element("Language")); this.Language = Languages.GetLanguage((string)element.Element("Language"));
this.LanguageVersion = Language.LanguageVersions.FirstOrDefault(v => v.Version == (string)element.Element("LanguageVersion")); this.LanguageVersion = Language.LanguageVersions.FirstOrDefault(v => v.Version == (string)element.Element("LanguageVersion"));
if (this.LanguageVersion == default(LanguageVersion)) if (this.LanguageVersion == default(LanguageVersion))

47
ILSpy/ILSpy.csproj

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net46</TargetFramework> <TargetFramework>net46</TargetFramework>
@ -8,6 +8,9 @@
<GenerateAssemblyInfo>False</GenerateAssemblyInfo> <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<EnableDefaultItems>false</EnableDefaultItems> <EnableDefaultItems>false</EnableDefaultItems>
<ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
<ExtrasEnableDefaultPageItems>false</ExtrasEnableDefaultPageItems>
<ExtrasEnableDefaultResourceItems>false</ExtrasEnableDefaultResourceItems>
<RootNamespace>ICSharpCode.ILSpy</RootNamespace> <RootNamespace>ICSharpCode.ILSpy</RootNamespace>
@ -34,11 +37,6 @@
<CodeAnalysisRuleSet>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<!-- Workaround for lack of XAML support in the new project system -->
<LanguageTargets>$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
@ -258,7 +256,6 @@
<Resource Include="Images\Delete.png" /> <Resource Include="Images\Delete.png" />
<Resource Include="Images\ILSpy.ico" /> <Resource Include="Images\ILSpy.ico" />
<Resource Include="Images\FindAssembly.png" /> <Resource Include="Images\FindAssembly.png" />
<None Include="app.config" />
<EmbeddedResource Include="TextView\CSharp-Mode.xshd" /> <EmbeddedResource Include="TextView\CSharp-Mode.xshd" />
<Resource Include="Images\Breakpoint.png" /> <Resource Include="Images\Breakpoint.png" />
<Resource Include="Images\CurrentLine.png" /> <Resource Include="Images\CurrentLine.png" />
@ -392,42 +389,6 @@
<None Include="@(Resource)" /> <None Include="@(Resource)" />
</ItemGroup> </ItemGroup>
<!--
Work around to fix Intellisense file generation for XAML projects
https://github.com/dotnet/project-system/issues/2488
-->
<Target Name="WorkaroundForXAMLIntellisenseBuildIssue" AfterTargets="_CheckCompileDesignTimePrerequisite">
<PropertyGroup>
<BuildingProject>false</BuildingProject>
</PropertyGroup>
</Target>
<!--
Workaround: nuget packages do not get added to the vsix automatically.
Copy them to a local folder and then include them as Content-items in the AddIn.
(related to https://github.com/icsharpcode/ILSpy/issues/511)
-->
<Target Name="CopyNugetPackagesToAddIn" AfterTargets="PostBuildEvent">
<ItemGroup>
<NuGetPackagesToCopy Include="$(TargetDir)System.ValueTuple.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Collections.Immutable.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Composition.AttributedModel.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Composition.Convention.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Composition.Hosting.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Composition.Runtime.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Composition.TypedParts.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Threading.Tasks.Dataflow.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)ICSharpCode.AvalonEdit.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)Humanizer.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)System.Reflection.Metadata.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)Microsoft.VisualStudio.Composition.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)Microsoft.VisualStudio.Validation.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)Mono.Cecil.dll" />
<NuGetPackagesToCopy Include="$(TargetDir)Mono.Cecil.Pdb.dll" />
</ItemGroup>
<Copy SourceFiles="@(NuGetPackagesToCopy)" DestinationFolder="..\ILSpy.AddIn\packages" />
</Target>
<PropertyGroup> <PropertyGroup>
<VCBasePath>$(MSBuildToolsPath)\..\..\..\VC\</VCBasePath> <VCBasePath>$(MSBuildToolsPath)\..\..\..\VC\</VCBasePath>
<VCToolsVersionPropsFile>$(VCBasePath)Auxiliary\Build\Microsoft.VCToolsVersion.default.props</VCToolsVersionPropsFile> <VCToolsVersionPropsFile>$(VCBasePath)Auxiliary\Build\Microsoft.VCToolsVersion.default.props</VCToolsVersionPropsFile>

11
ILSpy/MainWindow.xaml.cs

@ -381,9 +381,6 @@ namespace ICSharpCode.ILSpy
} }
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => OpenAssemblies(spySettings))); Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => OpenAssemblies(spySettings)));
#if DEBUG
this.Title = $"ILSpy {RevisionClass.FullVersion}";
#endif
} }
void OpenAssemblies(ILSpySettings spySettings) void OpenAssemblies(ILSpySettings spySettings)
@ -508,9 +505,17 @@ namespace ICSharpCode.ILSpy
treeView.Root = assemblyListTreeNode; treeView.Root = assemblyListTreeNode;
if (assemblyList.ListName == AssemblyListManager.DefaultListName) if (assemblyList.ListName == AssemblyListManager.DefaultListName)
#if DEBUG
this.Title = $"ILSpy {RevisionClass.FullVersion}";
#else
this.Title = "ILSpy"; this.Title = "ILSpy";
#endif
else else
#if DEBUG
this.Title = $"ILSpy {RevisionClass.FullVersion} - " + assemblyList.ListName;
#else
this.Title = "ILSpy - " + assemblyList.ListName; this.Title = "ILSpy - " + assemblyList.ListName;
#endif
} }
void assemblyList_Assemblies_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) void assemblyList_Assemblies_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)

95
ILSpy/NativeMethods.cs

@ -19,6 +19,7 @@
using System; using System;
using System.Text; using System.Text;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.ComponentModel;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
@ -50,6 +51,100 @@ namespace ICSharpCode.ILSpy
[DllImport("user32.dll", CharSet = CharSet.Auto)] [DllImport("user32.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SetForegroundWindow(IntPtr hWnd); internal static extern bool SetForegroundWindow(IntPtr hWnd);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass")]
[DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
static extern unsafe char** CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string lpCmdLine, out int pNumArgs);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass")]
[DllImport("kernel32.dll")]
static extern IntPtr LocalFree(IntPtr hMem);
#region CommandLine <-> Argument Array
/// <summary>
/// Decodes a command line into an array of arguments according to the CommandLineToArgvW rules.
/// </summary>
/// <remarks>
/// Command line parsing rules:
/// - 2n backslashes followed by a quotation mark produce n backslashes, and the quotation mark is considered to be the end of the argument.
/// - (2n) + 1 backslashes followed by a quotation mark again produce n backslashes followed by a quotation mark.
/// - n backslashes not followed by a quotation mark simply produce n backslashes.
/// </remarks>
public static unsafe string[] CommandLineToArgumentArray(string commandLine)
{
if (string.IsNullOrEmpty(commandLine))
return new string[0];
int numberOfArgs;
char** arr = CommandLineToArgvW(commandLine, out numberOfArgs);
if (arr == null)
throw new Win32Exception();
try {
string[] result = new string[numberOfArgs];
for (int i = 0; i < numberOfArgs; i++) {
result[i] = new string(arr[i]);
}
return result;
} finally {
// Free memory obtained by CommandLineToArgW.
LocalFree(new IntPtr(arr));
}
}
static readonly char[] charsNeedingQuoting = { ' ', '\t', '\n', '\v', '"' };
/// <summary>
/// Escapes a set of arguments according to the CommandLineToArgvW rules.
/// </summary>
/// <remarks>
/// Command line parsing rules:
/// - 2n backslashes followed by a quotation mark produce n backslashes, and the quotation mark is considered to be the end of the argument.
/// - (2n) + 1 backslashes followed by a quotation mark again produce n backslashes followed by a quotation mark.
/// - n backslashes not followed by a quotation mark simply produce n backslashes.
/// </remarks>
public static string ArgumentArrayToCommandLine(params string[] arguments)
{
if (arguments == null)
return null;
StringBuilder b = new StringBuilder();
for (int i = 0; i < arguments.Length; i++) {
if (i > 0)
b.Append(' ');
AppendArgument(b, arguments[i]);
}
return b.ToString();
}
static void AppendArgument(StringBuilder b, string arg)
{
if (arg == null) {
return;
}
if (arg.Length > 0 && arg.IndexOfAny(charsNeedingQuoting) < 0) {
b.Append(arg);
} else {
b.Append('"');
for (int j = 0; ; j++) {
int backslashCount = 0;
while (j < arg.Length && arg[j] == '\\') {
backslashCount++;
j++;
}
if (j == arg.Length) {
b.Append('\\', backslashCount * 2);
break;
} else if (arg[j] == '"') {
b.Append('\\', backslashCount * 2 + 1);
b.Append('"');
} else {
b.Append('\\', backslashCount);
b.Append(arg[j]);
}
}
b.Append('"');
}
}
#endregion
} }
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]

4
ILSpy/Properties/AssemblyInfo.template.cs

@ -39,10 +39,10 @@ using System.Diagnostics.CodeAnalysis;
internal static class RevisionClass internal static class RevisionClass
{ {
public const string Major = "4"; public const string Major = "4";
public const string Minor = "0"; public const string Minor = "1";
public const string Build = "0"; public const string Build = "0";
public const string Revision = "$INSERTREVISION$"; public const string Revision = "$INSERTREVISION$";
public const string VersionName = "rc1"; public const string VersionName = "alpha1";
public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$"; public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$";
} }

2
ILSpy/Search/SearchPane.cs

@ -200,7 +200,7 @@ namespace ICSharpCode.ILSpy
{ {
this.dispatcher = Dispatcher.CurrentDispatcher; this.dispatcher = Dispatcher.CurrentDispatcher;
this.assemblies = assemblies; this.assemblies = assemblies;
this.searchTerm = searchTerm.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); this.searchTerm = NativeMethods.CommandLineToArgumentArray(searchTerm);
this.language = language; this.language = language;
this.searchMode = searchMode; this.searchMode = searchMode;

12
ILSpy/TreeNodes/TypeTreeNode.cs

@ -79,10 +79,16 @@ namespace ICSharpCode.ILSpy.TreeNodes
foreach (var nestedType in TypeDefinition.NestedTypes.OrderBy(t => t.Name, NaturalStringComparer.Instance)) { foreach (var nestedType in TypeDefinition.NestedTypes.OrderBy(t => t.Name, NaturalStringComparer.Instance)) {
this.Children.Add(new TypeTreeNode(nestedType, ParentAssemblyNode)); this.Children.Add(new TypeTreeNode(nestedType, ParentAssemblyNode));
} }
foreach (var field in TypeDefinition.Fields.OrderBy(f => f.Name, NaturalStringComparer.Instance)) { if (TypeDefinition.Kind == TypeKind.Enum) {
this.Children.Add(new FieldTreeNode(field)); // if the type is an enum, it's better to not sort by field name.
foreach (var field in TypeDefinition.Fields) {
this.Children.Add(new FieldTreeNode(field));
}
} else {
foreach (var field in TypeDefinition.Fields.OrderBy(f => f.Name, NaturalStringComparer.Instance)) {
this.Children.Add(new FieldTreeNode(field));
}
} }
foreach (var property in TypeDefinition.Properties.OrderBy(p => p.Name, NaturalStringComparer.Instance)) { foreach (var property in TypeDefinition.Properties.OrderBy(p => p.Name, NaturalStringComparer.Instance)) {
this.Children.Add(new PropertyTreeNode(property)); this.Children.Add(new PropertyTreeNode(property));
} }

10
SharpTreeView/ICSharpCode.TreeView.csproj

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net46</TargetFramework> <TargetFramework>net46</TargetFramework>
@ -7,6 +7,9 @@
<GenerateAssemblyInfo>False</GenerateAssemblyInfo> <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<EnableDefaultItems>false</EnableDefaultItems> <EnableDefaultItems>false</EnableDefaultItems>
<ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
<ExtrasEnableDefaultPageItems>false</ExtrasEnableDefaultPageItems>
<ExtrasEnableDefaultResourceItems>false</ExtrasEnableDefaultResourceItems>
<SignAssembly>True</SignAssembly> <SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile>
@ -22,11 +25,6 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<!-- Workaround for lack of XAML support in the new project system -->
<LanguageTargets>$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />

10
TestPlugin/TestPlugin.csproj

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net461</TargetFramework> <TargetFramework>net461</TargetFramework>
@ -8,6 +8,9 @@
<GenerateAssemblyInfo>False</GenerateAssemblyInfo> <GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<EnableDefaultItems>False</EnableDefaultItems> <EnableDefaultItems>False</EnableDefaultItems>
<ExtrasEnableWpfProjectSetup>true</ExtrasEnableWpfProjectSetup>
<ExtrasEnableDefaultPageItems>false</ExtrasEnableDefaultPageItems>
<ExtrasEnableDefaultResourceItems>false</ExtrasEnableDefaultResourceItems>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
@ -21,11 +24,6 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<!-- Workaround for lack of XAML support in the new project system -->
<LanguageTargets>$(MSBuildExtensionsPath)\$(VisualStudioVersion)\Bin\Microsoft.CSharp.targets</LanguageTargets>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />

5
global.json

@ -0,0 +1,5 @@
{
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "1.6.65"
}
}
Loading…
Cancel
Save