Browse Source

Fix #1390: Extension methods used in collection initializers were not converted correctly.

pull/1397/head
Siegfried Pammer 6 years ago
parent
commit
e9cf52d1d5
  1. 40
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.cs
  2. 148
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.il
  3. 200
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.il
  4. 176
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.opt.roslyn.il
  5. 183
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/InitializerTests.roslyn.il
  6. 42
      ICSharpCode.Decompiler/CSharp/CallBuilder.cs

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

@ -27,7 +27,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests @@ -27,7 +27,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
{
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)
{
}
}
@ -1544,13 +1548,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests @@ -1544,13 +1548,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
#if CS60
X(Y(), new CustomList<int> {
{
1,
2
"1",
"2"
}
});
#else
CustomList<int> customList = new CustomList<int>();
customList.Add(1, 2);
customList.Add("1", "2");
X(Y(), customList);
#endif
}
@ -1703,7 +1707,33 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests @@ -1703,7 +1707,33 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests
[(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
#endregion
}
}
}

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

@ -15,10 +15,10 @@ @@ -15,10 +15,10 @@
}
.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
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.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
@ -40,8 +40,8 @@ @@ -40,8 +40,8 @@
{
.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,
int32 a,
int32 b) cil managed
string a,
string b) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 2 (0x2)
@ -50,6 +50,19 @@ @@ -50,6 +50,19 @@
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 )
.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
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
@ -1413,7 +1426,7 @@ @@ -1413,7 +1426,7 @@
IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1471,7 +1484,7 @@ @@ -1471,7 +1484,7 @@
IL_000f: ldc.i4.s 10
IL_0011: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0021: stelem.ref
@ -1499,7 +1512,7 @@ @@ -1499,7 +1512,7 @@
IL_003b: ldc.i4.6
IL_003c: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_004c: stelem.ref
@ -1762,7 +1775,7 @@ @@ -1762,7 +1775,7 @@
IL_0006: ldc.i4.8
IL_0007: newarr [mscorlib]System.Boolean
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1780,7 +1793,7 @@ @@ -1780,7 +1793,7 @@
IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.Byte
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1798,7 +1811,7 @@ @@ -1798,7 +1811,7 @@
IL_0006: ldc.i4.8
IL_0007: newarr [mscorlib]System.SByte
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1816,7 +1829,7 @@ @@ -1816,7 +1829,7 @@
IL_0006: ldc.i4.5
IL_0007: newarr [mscorlib]System.Int16
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1834,7 +1847,7 @@ @@ -1834,7 +1847,7 @@
IL_0006: ldc.i4.6
IL_0007: newarr [mscorlib]System.UInt16
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1852,7 +1865,7 @@ @@ -1852,7 +1865,7 @@
IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1870,7 +1883,7 @@ @@ -1870,7 +1883,7 @@
IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.UInt32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1888,7 +1901,7 @@ @@ -1888,7 +1901,7 @@
IL_0006: ldc.i4.5
IL_0007: newarr [mscorlib]System.Int64
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1906,7 +1919,7 @@ @@ -1906,7 +1919,7 @@
IL_0006: ldc.i4.s 10
IL_0008: newarr [mscorlib]System.UInt64
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0018: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1924,7 +1937,7 @@ @@ -1924,7 +1937,7 @@
IL_0006: ldc.i4.6
IL_0007: newarr [mscorlib]System.Single
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1942,7 +1955,7 @@ @@ -1942,7 +1955,7 @@
IL_0006: ldc.i4.6
IL_0007: newarr [mscorlib]System.Double
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -2088,7 +2101,7 @@ @@ -2088,7 +2101,7 @@
IL_0004: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0014: stloc.0
@ -2116,7 +2129,7 @@ @@ -2116,7 +2129,7 @@
IL_000c: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001c: stelem.ref
@ -2127,7 +2140,7 @@ @@ -2127,7 +2140,7 @@
IL_0021: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0031: stelem.ref
@ -2138,7 +2151,7 @@ @@ -2138,7 +2151,7 @@
IL_0036: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0046: stelem.ref
@ -2149,7 +2162,7 @@ @@ -2149,7 +2162,7 @@
IL_004b: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_005b: stelem.ref
@ -2181,7 +2194,7 @@ @@ -2181,7 +2194,7 @@
int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001d: stelem.ref
@ -2194,7 +2207,7 @@ @@ -2194,7 +2207,7 @@
int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0033: stelem.ref
@ -3415,7 +3428,7 @@ @@ -3415,7 +3428,7 @@
IL_0001: ldc.i4.4
IL_0002: newarr [mscorlib]System.Byte
IL_0007: dup
IL_0008: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000044-1'
IL_0008: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000045-1'
IL_000d: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0012: stloc.0
@ -3540,34 +3553,25 @@ @@ -3540,34 +3553,25 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{
// Code size 43 (0x2b)
.maxstack 4
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0,
int32[] V_1)
// Code size 37 (0x25)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
IL_0000: nop
IL_0001: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor()
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldc.i4.2
IL_0009: newarr [mscorlib]System.Int32
IL_000e: stloc.1
IL_000f: ldloc.1
IL_0010: ldc.i4.0
IL_0011: ldc.i4.1
IL_0012: stelem.i4
IL_0013: ldloc.1
IL_0014: ldc.i4.1
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,
IL_0008: ldstr "1"
IL_000d: ldstr "2"
IL_0012: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
string,
string)
IL_0017: nop
IL_0018: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_001d: ldloc.0
IL_001e: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object)
IL_0029: nop
IL_002a: ret
IL_0023: nop
IL_0024: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -4680,7 +4684,7 @@ @@ -4680,7 +4684,7 @@
IL_0787: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
IL_078c: dup
IL_078d: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '<PrivateImplementationDetails>'::'$$method0x6000093-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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0797: stsfld int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Issue1336_rg2
@ -4763,29 +4767,29 @@ @@ -4763,29 +4767,29 @@
.size 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' '$$method0x600000c-1' at I_00002138
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000c-2' at I_00002160
.field static assembly int64 '$$method0x600000f-1' at I_00002418
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000010-1' at I_00002440
.field static assembly int64 '$$method0x6000011-1' at I_00002470
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000012-1' at I_00002498
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000013-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_00002540
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_00002588
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000017-1' at I_000025D0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000018-1' at I_00002640
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x6000019-1' at I_00002678
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001d-1' at I_000027C0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-1' at I_000028E8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-2' at I_00002928
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-3' at I_00002968
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-4' at I_000029A8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-1' at I_00002A58
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-2' at I_00002AA0
.field static assembly int32 '$$method0x6000044-1' at I_000034B8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000093-1' at I_000037A0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000b-1' at I_000020C0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000d-1' at I_00002138
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000d-2' at I_00002160
.field static assembly int64 '$$method0x6000010-1' at I_00002418
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000011-1' at I_00002440
.field static assembly int64 '$$method0x6000012-1' at I_00002470
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000013-1' at I_00002498
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000014-1' at I_000024C8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000015-1' at I_000024F8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_00002540
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000017-1' at I_00002588
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000018-1' at I_000025D0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000019-1' at I_00002640
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x600001a-1' at I_00002678
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001e-1' at I_000027C0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-1' at I_000028E8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-2' at I_00002928
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-3' at I_00002968
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-4' at I_000029A8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-1' at I_00002A58
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-2' at I_00002AA0
.field static assembly int32 '$$method0x6000045-1' at I_000034B8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000094-1' at I_000037A0
} // end of class '<PrivateImplementationDetails>'

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

@ -15,10 +15,10 @@ @@ -15,10 +15,10 @@
}
.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
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.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
.permissionset reqmin
= {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
.hash algorithm 0x00008004
@ -40,8 +40,8 @@ @@ -40,8 +40,8 @@
{
.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,
int32 a,
int32 b) cil managed
string a,
string b) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 1 (0x1)
@ -49,6 +49,18 @@ @@ -49,6 +49,18 @@
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 )
.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
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
@ -1226,7 +1238,7 @@ @@ -1226,7 +1238,7 @@
IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1280,7 +1292,7 @@ @@ -1280,7 +1292,7 @@
IL_000e: ldc.i4.s 10
IL_0010: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0020: stelem.ref
@ -1308,7 +1320,7 @@ @@ -1308,7 +1320,7 @@
IL_003a: ldc.i4.6
IL_003b: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_004b: stelem.ref
@ -1571,7 +1583,7 @@ @@ -1571,7 +1583,7 @@
IL_0005: ldc.i4.8
IL_0006: newarr [mscorlib]System.Boolean
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1587,7 +1599,7 @@ @@ -1587,7 +1599,7 @@
IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.Byte
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1603,7 +1615,7 @@ @@ -1603,7 +1615,7 @@
IL_0005: ldc.i4.8
IL_0006: newarr [mscorlib]System.SByte
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1619,7 +1631,7 @@ @@ -1619,7 +1631,7 @@
IL_0005: ldc.i4.5
IL_0006: newarr [mscorlib]System.Int16
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1635,7 +1647,7 @@ @@ -1635,7 +1647,7 @@
IL_0005: ldc.i4.6
IL_0006: newarr [mscorlib]System.UInt16
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1651,7 +1663,7 @@ @@ -1651,7 +1663,7 @@
IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.Int32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1667,7 +1679,7 @@ @@ -1667,7 +1679,7 @@
IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.UInt32
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1683,7 +1695,7 @@ @@ -1683,7 +1695,7 @@
IL_0005: ldc.i4.5
IL_0006: newarr [mscorlib]System.Int64
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1699,7 +1711,7 @@ @@ -1699,7 +1711,7 @@
IL_0005: ldc.i4.s 10
IL_0007: newarr [mscorlib]System.UInt64
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0017: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1715,7 +1727,7 @@ @@ -1715,7 +1727,7 @@
IL_0005: ldc.i4.6
IL_0006: newarr [mscorlib]System.Single
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1731,7 +1743,7 @@ @@ -1731,7 +1743,7 @@
IL_0005: ldc.i4.6
IL_0006: newarr [mscorlib]System.Double
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
@ -1868,7 +1880,7 @@ @@ -1868,7 +1880,7 @@
IL_0003: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0013: ret
@ -1890,7 +1902,7 @@ @@ -1890,7 +1902,7 @@
IL_000b: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001b: stelem.ref
@ -1901,7 +1913,7 @@ @@ -1901,7 +1913,7 @@
IL_0020: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0030: stelem.ref
@ -1912,7 +1924,7 @@ @@ -1912,7 +1924,7 @@
IL_0035: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0045: stelem.ref
@ -1923,7 +1935,7 @@ @@ -1923,7 +1935,7 @@
IL_004a: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_005a: stelem.ref
@ -1949,7 +1961,7 @@ @@ -1949,7 +1961,7 @@
int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_001c: stelem.ref
@ -1962,7 +1974,7 @@ @@ -1962,7 +1974,7 @@
int32,
int32)
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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0032: stelem.ref
@ -3007,7 +3019,7 @@ @@ -3007,7 +3019,7 @@
IL_0000: ldc.i4.4
IL_0001: newarr [mscorlib]System.Byte
IL_0006: dup
IL_0007: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000044-1'
IL_0007: ldtoken field int32 '<PrivateImplementationDetails>'::'$$method0x6000045-1'
IL_000c: call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class [mscorlib]System.Array,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_0011: ret
@ -3106,31 +3118,22 @@ @@ -3106,31 +3118,22 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{
// Code size 40 (0x28)
.maxstack 4
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0,
int32[] V_1)
// Code size 34 (0x22)
.maxstack 3
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
IL_0000: newobj instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>::.ctor()
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: ldc.i4.2
IL_0008: newarr [mscorlib]System.Int32
IL_000d: stloc.1
IL_000e: ldloc.1
IL_000f: ldc.i4.0
IL_0010: ldc.i4.1
IL_0011: stelem.i4
IL_0012: ldloc.1
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,
IL_0007: ldstr "1"
IL_000c: ldstr "2"
IL_0011: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
string,
string)
IL_0016: call object ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Y()
IL_001b: ldloc.0
IL_001c: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object)
IL_0027: ret
IL_0021: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -4218,7 +4221,7 @@ @@ -4218,7 +4221,7 @@
IL_07df: newobj instance void int32[0...,0...]::.ctor(int32,
int32)
IL_07e4: dup
IL_07e5: ldtoken field valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '<PrivateImplementationDetails>'::'$$method0x6000093-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,
valuetype [mscorlib]System.RuntimeFieldHandle)
IL_07ef: stsfld int32[0...,0...] ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::Issue1336_rg2
@ -4301,86 +4304,86 @@ @@ -4301,86 +4304,86 @@
.size 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' '$$method0x600000c-1' at I_000020E8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000c-2' at I_00002110
.field static assembly int64 '$$method0x600000f-1' at I_000023D0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000010-1' at I_000023F8
.field static assembly int64 '$$method0x6000011-1' at I_00002420
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000012-1' at I_00002448
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000013-1' at I_00002470
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000014-1' at I_000024A0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000015-1' at I_000024E8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_00002530
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000017-1' at I_00002578
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000018-1' at I_000025E8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x6000019-1' at I_00002620
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001d-1' at I_00002760
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-1' at I_00002878
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-2' at I_000028B8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-3' at I_000028F8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001e-4' at I_00002938
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-1' at I_000029E8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x600001f-2' at I_00002A30
.field static assembly int32 '$$method0x6000044-1' at I_00003388
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000093-1' at I_00003628
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000b-1' at I_00002078
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x600000d-1' at I_000020F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x600000d-2' at I_00002118
.field static assembly int64 '$$method0x6000010-1' at I_000023D8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000011-1' at I_00002400
.field static assembly int64 '$$method0x6000012-1' at I_00002428
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '$$method0x6000013-1' at I_00002450
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '$$method0x6000014-1' at I_00002478
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000015-1' at I_000024A8
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000016-1' at I_000024F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '$$method0x6000017-1' at I_00002538
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '$$method0x6000018-1' at I_00002580
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' '$$method0x6000019-1' at I_000025F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' '$$method0x600001a-1' at I_00002628
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' '$$method0x600001e-1' at I_00002768
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-1' at I_00002880
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-2' at I_000028C0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-3' at I_00002900
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '$$method0x600001f-4' at I_00002940
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-1' at I_000029F0
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '$$method0x6000020-2' at I_00002A38
.field static assembly int32 '$$method0x6000045-1' at I_00003390
.field static assembly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' '$$method0x6000094-1' at I_00003628
} // 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
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_000020E8 = bytearray (
.data cil I_000020F0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00002110 = bytearray (
.data cil I_00002118 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00)
.data cil I_00002128 = int8[8]
.data cil I_000023D0 = bytearray (
.data cil I_000023D8 = bytearray (
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)
.data cil I_00002402 = int8[30]
.data cil I_00002420 = bytearray (
.data cil I_0000240A = int8[6]
.data cil I_00002428 = bytearray (
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)
.data cil I_00002452 = int8[14]
.data cil I_00002470 = bytearray (
.data cil I_0000245A = int8[6]
.data cil I_00002478 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_0000247C = int8[4]
.data cil I_000024A0 = bytearray (
.data cil I_00002484 = int8[4]
.data cil I_000024A8 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_000024E8 = bytearray (
.data cil I_000024F0 = bytearray (
01 00 00 00 00 94 35 77 00 5E D0 B2 04 00 00 00 // ......5w.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00002530 = bytearray (
.data cil I_00002538 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_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....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_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 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 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_00002650 = int8[16]
.data cil I_00002760 = bytearray (
.data cil I_00002768 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4397,41 +4400,42 @@ @@ -4397,41 +4400,42 @@
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
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_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)
.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
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_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)
.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
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00)
.data cil I_00002A30 = bytearray (
.data cil I_00002A38 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'...
.data cil I_00003388 = bytearray (
.data cil I_00003390 = bytearray (
00 01 02 FF)
.data cil I_0000338C = int8[4]
.data cil I_00003394 = int8[4]
.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

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

@ -44,8 +44,8 @@ @@ -44,8 +44,8 @@
{
.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,
int32 a,
int32 b) cil managed
string a,
string b) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 1 (0x1)
@ -53,6 +53,18 @@ @@ -53,6 +53,18 @@
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 )
.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
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
@ -3039,28 +3051,19 @@ @@ -3039,28 +3051,19 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{
// Code size 38 (0x26)
.maxstack 6
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
// Code size 32 (0x20)
.maxstack 8
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_000a: stloc.0
IL_000b: ldloc.0
IL_000c: ldc.i4.2
IL_000d: newarr [mscorlib]System.Int32
IL_0012: dup
IL_0013: ldc.i4.0
IL_0014: ldc.i4.1
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,
IL_000a: dup
IL_000b: ldstr "1"
IL_0010: ldstr "2"
IL_0015: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
string,
string)
IL_001a: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object)
IL_0025: ret
IL_001f: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -3369,6 +3372,47 @@ @@ -3369,6 +3372,47 @@
IL_0023: ret
} // 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
instance void .ctor() cil managed
{
@ -4267,68 +4311,68 @@ @@ -4267,68 +4311,68 @@
.size 256
} // end of class '__StaticArrayInitTypeSize=256'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00006E70
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_00006EB8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_00006EC8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_00006F10
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_00006F20
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00006F30
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00006F70
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_00006F98
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_00006FE8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000070E8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_000070F0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_00007118
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007140
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007158
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007160
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_00007190
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000071D0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_000071F8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_00007200
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00007228
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007040
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_00007088
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_00007098
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_000070E0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_000070F0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007100
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007140
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_00007168
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000071B8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000072B8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_000072C0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_000072E8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007310
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007328
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007330
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_00007360
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000073A0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_000073C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_000073D0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_000073F8
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_00006E70 = bytearray (
.data cil I_00007040 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00)
.data cil I_00006EB8 = bytearray (
.data cil I_00007088 = bytearray (
01 02 03 04 05 06 07 08 FE FF)
.data cil I_00006EC2 = int8[6]
.data cil I_00006EC8 = bytearray (
.data cil I_00007092 = int8[6]
.data cil I_00007098 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'...
.data cil I_00006F10 = bytearray (
.data cil I_000070E0 = bytearray (
00 80 FF FF 00 00 01 00 FF 7F)
.data cil I_00006F1A = int8[6]
.data cil I_00006F20 = bytearray (
.data cil I_000070EA = int8[6]
.data cil I_000070F0 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_00006F2C = int8[4]
.data cil I_00006F30 = 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)
.data cil I_00006F70 = bytearray (
.data cil I_00007140 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_00006F98 = bytearray (
.data cil I_00007168 = bytearray (
01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_00006FE8 = bytearray (
.data cil I_000071B8 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4345,43 +4389,43 @@ @@ -4345,43 +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)
.data cil I_000070E8 = bytearray (
.data cil I_000072B8 = bytearray (
80 81 00 01 02 03 04 7F)
.data cil I_000070F0 = 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)
.data cil I_00007114 = int8[4]
.data cil I_00007118 = 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.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007140 = bytearray (
.data cil I_00007310 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00)
.data cil I_00007158 = bytearray (
.data cil I_00007328 = bytearray (
00 01 02 FF)
.data cil I_0000715C = int8[4]
.data cil I_00007160 = 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 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_00007190 = bytearray (
.data cil I_00007360 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_000071D0 = bytearray (
.data cil I_000073A0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_000071F8 = bytearray (
.data cil I_000073C8 = bytearray (
01 00 01 00 00 00 01 01)
.data cil I_00007200 = bytearray (
.data cil I_000073D0 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007228 = bytearray (
.data cil I_000073F8 = bytearray (
00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?....
00 00 80 7F 00 00 C0 FF)
// *********** DISASSEMBLY COMPLETE ***********************

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

@ -44,8 +44,8 @@ @@ -44,8 +44,8 @@
{
.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,
int32 a,
int32 b) cil managed
string a,
string b) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 )
// Code size 2 (0x2)
@ -54,6 +54,19 @@ @@ -54,6 +54,19 @@
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 )
.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
.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases
@ -3429,31 +3442,22 @@ @@ -3429,31 +3442,22 @@
.method public hidebysig static void ExtensionMethodInCollectionInitializer() cil managed
{
// Code size 41 (0x29)
.maxstack 6
.locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32> V_0)
// Code size 35 (0x23)
.maxstack 8
IL_0000: nop
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_000b: stloc.0
IL_000c: ldloc.0
IL_000d: ldc.i4.2
IL_000e: newarr [mscorlib]System.Int32
IL_0013: dup
IL_0014: ldc.i4.0
IL_0015: ldc.i4.1
IL_0016: stelem.i4
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,
IL_000b: dup
IL_000c: ldstr "1"
IL_0011: ldstr "2"
IL_0016: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.Extensions::Add(class ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases/CustomList`1<int32>,
string,
string)
IL_001b: nop
IL_001c: call void ICSharpCode.Decompiler.Tests.TestCases.Pretty.InitializerTests.TestCases::X(object,
object)
IL_0027: nop
IL_0028: ret
IL_0021: nop
IL_0022: ret
} // end of method TestCases::ExtensionMethodInCollectionInitializer
.method public hidebysig static void NoCollectionInitializerBecauseOfTypeArguments() cil managed
@ -3826,6 +3830,52 @@ @@ -3826,6 +3830,52 @@
IL_0026: ret
} // 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
instance void .ctor() cil managed
{
@ -4725,67 +4775,68 @@ @@ -4725,67 +4775,68 @@
.size 256
} // end of class '__StaticArrayInitTypeSize=256'
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_0000729C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_000072E4
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_000072F4
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_0000733C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_0000734C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_0000735C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_0000739C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_000073C4
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_00007414
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_00007514
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_0000751C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_00007544
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_0000756C
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007584
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_0000758C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_000075BC
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000075FC
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_00007624
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_0000762C
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00007654
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '1535117EC92E41D4A6B7CA00F965357B05B5DC35' at I_00007480
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '20E3FF489634E18F3F7EB292AD504DBAE9519293' at I_000074C8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=72' '39E94835525CF7B71CD4595742EF462642FBF1B2' at I_000074D8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=10' '56D9EEC8EF899644C40B9BE9D886DF2367A5D078' at I_00007520
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=12' '735E5A21849E86F68D220F06163E8C5C6376B9C9' at I_00007530
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' '7C39B7B06DD624A17F875AB8E9651554BE6E74D2' at I_00007540
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' '8D903ECAD8D9D75B3183B23AF79F6D2E607369E3' at I_00007580
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=80' '9B1F6E56D755443CC39C1969CE38FD41FD4EF4B7' at I_000075A8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=256' A1EA7DC3FE43B3A54F5B729A92B92AF54181A3EB at I_000075F8
.field static assembly initonly int64 A6296CAC471BE2954899600137940479D8073C7C at I_000076F8
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=36' B62E59D20E3D69F06A6D9BD5E3C518FF7093EDAB at I_00007700
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' B9583930B842DBCEF0D7B8E57D4D3F1E8055C39E at I_00007728
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' C4E70AB31EF6C8908F896CAD1C6BC75F7FA65E27 at I_00007750
.field static assembly initonly int32 C62C27924F4C967F5EDDB1850C091D54C7A2AB58 at I_00007768
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=48' DC7043B0114737ACE19A23DD755893795FD48A23 at I_00007770
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=64' DCF557B883E6FE0AEC05B7F0290F0EF47D0AC2E3 at I_000077A0
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' E0D2592373A0C161E56E266306CD8405CD719D19 at I_000077E0
.field static assembly initonly int64 EB0715DBB235F3F696F2C404F5839C6650640898 at I_00007808
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=40' F514FF55B79BCAA2CEC9B56C062D976E45F89AB7 at I_00007810
.field static assembly initonly valuetype '<PrivateImplementationDetails>'/'__StaticArrayInitTypeSize=24' FBCB49C1A244C1B5781AA1DB02C5A11F68908526 at I_00007838
} // end of class '<PrivateImplementationDetails>'
// =============================================================
.data cil I_0000729C = bytearray (
.data cil I_00007480 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0B 00 00 00 0C 00 00 00 0D 00 00 00
0E 00 00 00 0F 00 00 00 10 00 00 00 11 00 00 00
12 00 00 00 13 00 00 00)
.data cil I_000072E4 = bytearray (
.data cil I_000074C8 = bytearray (
01 02 03 04 05 06 07 08 FE FF)
.data cil I_000072EE = int8[2]
.data cil I_000072F4 = bytearray (
.data cil I_000074D2 = int8[6]
.data cil I_000074D8 = bytearray (
15 00 00 00 16 00 00 00 17 00 00 00 18 00 00 00
19 00 00 00 1A 00 00 00 1B 00 00 00 1C 00 00 00
1D 00 00 00 1F 00 00 00 20 00 00 00 21 00 00 00 // ........ ...!...
22 00 00 00 23 00 00 00 24 00 00 00 25 00 00 00 // "...#...$...%...
26 00 00 00 27 00 00 00) // &...'...
.data cil I_0000733C = bytearray (
.data cil I_00007520 = bytearray (
00 80 FF FF 00 00 01 00 FF 7F)
.data cil I_00007346 = int8[2]
.data cil I_0000734C = bytearray (
.data cil I_0000752A = int8[6]
.data cil I_00007530 = bytearray (
00 00 01 00 FF 7F 00 80 FE FF FF FF)
.data cil I_0000735C = 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)
.data cil I_0000739C = bytearray (
.data cil I_00007580 = bytearray (
01 00 0C BB 7D 6E 9C BA FF FF FF FF FF FF FF FF // ....}n..........
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45) // ...D..cE
.data cil I_000073C4 = bytearray (
.data cil I_000075A8 = bytearray (
01 00 00 00 00 00 00 00 00 94 35 77 00 00 00 00 // ..........5w....
00 5E D0 B2 00 00 00 00 04 00 00 00 00 00 00 00 // .^..............
05 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00
07 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
FF FF F3 44 82 91 63 45 FF FF E7 89 04 23 C7 8A) // ...D..cE.....#..
.data cil I_00007414 = bytearray (
.data cil I_000075F8 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@ -4802,41 +4853,43 @@ @@ -4802,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)
.data cil I_00007514 = bytearray (
.data cil I_000076F8 = bytearray (
80 81 00 01 02 03 04 7F)
.data cil I_0000751C = 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)
.data cil I_00007544 = 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.^......
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_0000756C = bytearray (
.data cil I_00007750 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00)
.data cil I_00007584 = bytearray (
.data cil I_00007768 = bytearray (
00 01 02 FF)
.data cil I_0000758C = 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 3F 00 00 00 00 00 00 F0 FF // .......?........
00 00 00 00 00 00 F0 7F 00 00 00 00 00 00 F8 FF)
.data cil I_000075BC = bytearray (
.data cil I_000077A0 = bytearray (
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
.data cil I_000075FC = bytearray (
.data cil I_000077E0 = bytearray (
01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00
05 00 00 00 06 00 00 00 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007624 = bytearray (
.data cil I_00007808 = bytearray (
01 00 01 00 00 00 01 01)
.data cil I_0000762C = bytearray (
.data cil I_00007810 = bytearray (
01 00 00 00 FE FF FF FF 00 94 35 77 04 00 00 00 // ..........5w....
05 00 00 00 FA FF FF FF 07 00 00 00 08 00 00 00
09 00 00 00 0A 00 00 00)
.data cil I_00007654 = bytearray (
.data cil I_00007838 = bytearray (
00 00 C0 BF 00 00 00 00 00 00 C0 3F 00 00 80 FF // ...........?....
00 00 80 7F 00 00 C0 FF)
// *********** DISASSEMBLY COMPLETE ***********************

42
ICSharpCode.Decompiler/CSharp/CallBuilder.cs

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

Loading…
Cancel
Save