Browse Source

Update test cases for switch.

pull/887/head
Siegfried Pammer 8 years ago
parent
commit
c2761b0e02
  1. 2
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  2. 33
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs
  3. 807
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.il
  4. 529
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.il
  5. 84
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.roslyn.il
  6. 785
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.roslyn.il

2
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -97,7 +97,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -97,7 +97,7 @@ namespace ICSharpCode.Decompiler.Tests
Run(cscOptions: cscOptions);
}
[Test, Ignore("unnecessary casts on null literals, control-flow issues with switch in loops, goto, goto case, etc.")]
[Test]
public void Switch([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
Run(cscOptions: cscOptions);

33
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs

@ -213,6 +213,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -213,6 +213,25 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
public static string ShortSwitchOverStringWithNullCase(string text)
{
Console.WriteLine("ShortSwitchOverStringWithNullCase: " + text);
switch (text) {
case "First case": {
return "Text1";
}
case "Second case": {
return "Text2";
}
case null: {
return "null";
}
default: {
return "Default";
}
}
}
public static string SwitchOverString1(string text)
{
Console.WriteLine("SwitchOverString1: " + text);
@ -248,8 +267,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -248,8 +267,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public static string SwitchOverString2()
{
Console.WriteLine("SwitchOverString2:");
string userName = Environment.UserName;
switch (userName) {
switch (Environment.UserName) {
case "First case": {
return "Text1";
}
@ -318,10 +336,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -318,10 +336,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
Console.WriteLine("two");
break;
}
case 3: {
Console.WriteLine("three");
continue;
}
//case 3: {
// Console.WriteLine("three");
// continue;
// }
case 4: {
Console.WriteLine("four");
return;
@ -376,8 +394,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -376,8 +394,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
SetProperty[] properties = Switch.GetProperties();
for (int i = 0; i < properties.Length; i++) {
SetProperty setProperty = properties[i];
string name = setProperty.Property.Name;
switch (name) {
switch (setProperty.Property.Name) {
case "Name1": {
setProperty.Set = 1;
list.Add(setProperty);

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

File diff suppressed because it is too large Load Diff

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

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly nwkzngd2
.assembly '4wc22bae'
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
@ -20,15 +20,15 @@ @@ -20,15 +20,15 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module nwkzngd2.dll
// MVID: {2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}
.module '4wc22bae.dll'
// MVID: {B84EA70D-C67F-455B-9708-0E39585F7DA1}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x008E0000
// Image base: 0x01140000
// =============== CLASS MEMBERS DECLARATION ===================
@ -509,6 +509,49 @@ @@ -509,6 +509,49 @@
IL_0055: ret
} // end of method Switch::ShortSwitchOverString
.method public hidebysig static string
ShortSwitchOverStringWithNullCase(string text) cil managed
{
// Code size 73 (0x49)
.maxstack 2
.locals init (string V_0)
IL_0000: ldstr "ShortSwitchOverStringWithNullCase: "
IL_0005: ldarg.0
IL_0006: call string [mscorlib]System.String::Concat(string,
string)
IL_000b: call void [mscorlib]System.Console::WriteLine(string)
IL_0010: ldarg.0
IL_0011: dup
IL_0012: stloc.0
IL_0013: brfalse.s IL_003d
IL_0015: ldloc.0
IL_0016: ldstr "First case"
IL_001b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0020: brtrue.s IL_0031
IL_0022: ldloc.0
IL_0023: ldstr "Second case"
IL_0028: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_002d: brtrue.s IL_0037
IL_002f: br.s IL_0043
IL_0031: ldstr "Text1"
IL_0036: ret
IL_0037: ldstr "Text2"
IL_003c: ret
IL_003d: ldstr "null"
IL_0042: ret
IL_0043: ldstr "Default"
IL_0048: ret
} // end of method Switch::ShortSwitchOverStringWithNullCase
.method public hidebysig static string
SwitchOverString1(string text) cil managed
{
@ -527,7 +570,7 @@ @@ -527,7 +570,7 @@
IL_0013: brfalse IL_00db
IL_0018: volatile.
IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x6000008-1'
IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x6000009-1'
IL_001f: brtrue.s IL_0082
IL_0021: ldc.i4.7
@ -568,9 +611,9 @@ @@ -568,9 +611,9 @@
IL_0076: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_007b: volatile.
IL_007d: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x6000008-1'
IL_007d: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x6000009-1'
IL_0082: volatile.
IL_0084: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x6000008-1'
IL_0084: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x6000009-1'
IL_0089: ldloc.0
IL_008a: ldloca.s V_1
IL_008c: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
@ -616,141 +659,138 @@ @@ -616,141 +659,138 @@
.method public hidebysig static string
SwitchOverString2() cil managed
{
// Code size 325 (0x145)
// Code size 323 (0x143)
.maxstack 4
.locals init (string V_0,
string V_1,
int32 V_2)
int32 V_1)
IL_0000: ldstr "SwitchOverString2:"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: call string [mscorlib]System.Environment::get_UserName()
IL_000f: stloc.0
IL_0010: ldloc.0
IL_0011: dup
IL_0012: stloc.1
IL_0013: brfalse IL_013f
IL_0018: volatile.
IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x6000009-1'
IL_001f: brtrue IL_00b8
IL_0024: ldc.i4.s 11
IL_0026: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::.ctor(int32)
IL_002b: dup
IL_002c: ldstr "First case"
IL_0031: ldc.i4.0
IL_0032: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_000f: dup
IL_0010: stloc.0
IL_0011: brfalse IL_013d
IL_0016: volatile.
IL_0018: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x600000a-1'
IL_001d: brtrue IL_00b6
IL_0022: ldc.i4.s 11
IL_0024: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::.ctor(int32)
IL_0029: dup
IL_002a: ldstr "First case"
IL_002f: ldc.i4.0
IL_0030: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0037: dup
IL_0038: ldstr "Second case"
IL_003d: ldc.i4.1
IL_003e: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0035: dup
IL_0036: ldstr "Second case"
IL_003b: ldc.i4.1
IL_003c: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0043: dup
IL_0044: ldstr "Third case"
IL_0049: ldc.i4.2
IL_004a: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0041: dup
IL_0042: ldstr "Third case"
IL_0047: ldc.i4.2
IL_0048: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_004f: dup
IL_0050: ldstr "Fourth case"
IL_0055: ldc.i4.3
IL_0056: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_004d: dup
IL_004e: ldstr "Fourth case"
IL_0053: ldc.i4.3
IL_0054: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_005b: dup
IL_005c: ldstr "Fifth case"
IL_0061: ldc.i4.4
IL_0062: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0059: dup
IL_005a: ldstr "Fifth case"
IL_005f: ldc.i4.4
IL_0060: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0067: dup
IL_0068: ldstr "Sixth case"
IL_006d: ldc.i4.5
IL_006e: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0065: dup
IL_0066: ldstr "Sixth case"
IL_006b: ldc.i4.5
IL_006c: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0073: dup
IL_0074: ldstr "Seventh case"
IL_0079: ldc.i4.6
IL_007a: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0071: dup
IL_0072: ldstr "Seventh case"
IL_0077: ldc.i4.6
IL_0078: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_007f: dup
IL_0080: ldstr "Eighth case"
IL_0085: ldc.i4.7
IL_0086: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_007d: dup
IL_007e: ldstr "Eighth case"
IL_0083: ldc.i4.7
IL_0084: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_008b: dup
IL_008c: ldstr "Ninth case"
IL_0091: ldc.i4.8
IL_0092: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0089: dup
IL_008a: ldstr "Ninth case"
IL_008f: ldc.i4.8
IL_0090: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0097: dup
IL_0098: ldstr "Tenth case"
IL_009d: ldc.i4.s 9
IL_009f: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0095: dup
IL_0096: ldstr "Tenth case"
IL_009b: ldc.i4.s 9
IL_009d: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_00a4: dup
IL_00a5: ldstr "Eleventh case"
IL_00aa: ldc.i4.s 10
IL_00ac: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_00a2: dup
IL_00a3: ldstr "Eleventh case"
IL_00a8: ldc.i4.s 10
IL_00aa: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_00b1: volatile.
IL_00b3: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x6000009-1'
IL_00b8: volatile.
IL_00ba: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x6000009-1'
IL_00bf: ldloc.1
IL_00c0: ldloca.s V_2
IL_00c2: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
IL_00af: volatile.
IL_00b1: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x600000a-1'
IL_00b6: volatile.
IL_00b8: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x600000a-1'
IL_00bd: ldloc.0
IL_00be: ldloca.s V_1
IL_00c0: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
!1&)
IL_00c7: brfalse.s IL_013f
IL_00c5: brfalse.s IL_013d
IL_00c9: ldloc.2
IL_00ca: switch (
IL_00fd,
IL_0103,
IL_0109,
IL_010f,
IL_0115,
IL_011b,
IL_0121,
IL_0127,
IL_012d,
IL_0133,
IL_0139)
IL_00fb: br.s IL_013f
IL_00c7: ldloc.1
IL_00c8: switch (
IL_00fb,
IL_0101,
IL_0107,
IL_010d,
IL_0113,
IL_0119,
IL_011f,
IL_0125,
IL_012b,
IL_0131,
IL_0137)
IL_00f9: br.s IL_013d
IL_00fd: ldstr "Text1"
IL_0102: ret
IL_00fb: ldstr "Text1"
IL_0100: ret
IL_0103: ldstr "Text2"
IL_0108: ret
IL_0101: ldstr "Text2"
IL_0106: ret
IL_0109: ldstr "Text3"
IL_010e: ret
IL_0107: ldstr "Text3"
IL_010c: ret
IL_010f: ldstr "Text4"
IL_0114: ret
IL_010d: ldstr "Text4"
IL_0112: ret
IL_0115: ldstr "Text5"
IL_011a: ret
IL_0113: ldstr "Text5"
IL_0118: ret
IL_011b: ldstr "Text6"
IL_0120: ret
IL_0119: ldstr "Text6"
IL_011e: ret
IL_0121: ldstr "Text7"
IL_0126: ret
IL_011f: ldstr "Text7"
IL_0124: ret
IL_0127: ldstr "Text8"
IL_012c: ret
IL_0125: ldstr "Text8"
IL_012a: ret
IL_012d: ldstr "Text9"
IL_0132: ret
IL_012b: ldstr "Text9"
IL_0130: ret
IL_0133: ldstr "Text10"
IL_0138: ret
IL_0131: ldstr "Text10"
IL_0136: ret
IL_0139: ldstr "Text11"
IL_013e: ret
IL_0137: ldstr "Text11"
IL_013c: ret
IL_013f: ldstr "Default"
IL_0144: ret
IL_013d: ldstr "Default"
IL_0142: ret
} // end of method Switch::SwitchOverString2
.method public hidebysig static string
@ -785,7 +825,7 @@ @@ -785,7 +825,7 @@
.method public hidebysig static void SwitchInLoop(int32 i) cil managed
{
// Code size 124 (0x7c)
// Code size 112 (0x70)
.maxstack 2
.locals init (int32 V_0)
IL_0000: ldstr "SwitchInLoop: "
@ -802,37 +842,33 @@ @@ -802,37 +842,33 @@
IL_001a: switch (
IL_0031,
IL_003d,
IL_0049,
IL_0055)
IL_002f: br.s IL_0060
IL_0054,
IL_0049)
IL_002f: br.s IL_0054
IL_0031: ldstr "one"
IL_0036: call void [mscorlib]System.Console::WriteLine(string)
IL_003b: br.s IL_0075
IL_003b: br.s IL_0069
IL_003d: ldstr "two"
IL_0042: call void [mscorlib]System.Console::WriteLine(string)
IL_0047: br.s IL_0075
IL_0047: br.s IL_0069
IL_0049: ldstr "three"
IL_0049: ldstr "four"
IL_004e: call void [mscorlib]System.Console::WriteLine(string)
IL_0053: br.s IL_0015
IL_0053: ret
IL_0055: ldstr "four"
IL_005a: call void [mscorlib]System.Console::WriteLine(string)
IL_005f: ret
IL_0060: ldstr "default"
IL_0065: call void [mscorlib]System.Console::WriteLine(string)
IL_006a: ldstr "more code"
IL_006f: call void [mscorlib]System.Console::WriteLine(string)
IL_0074: ret
IL_0075: ldarg.0
IL_0076: ldc.i4.1
IL_0077: add
IL_0078: starg.s i
IL_007a: br.s IL_0015
IL_0054: ldstr "default"
IL_0059: call void [mscorlib]System.Console::WriteLine(string)
IL_005e: ldstr "more code"
IL_0063: call void [mscorlib]System.Console::WriteLine(string)
IL_0068: ret
IL_0069: ldarg.0
IL_006a: ldc.i4.1
IL_006b: add
IL_006c: starg.s i
IL_006e: br.s IL_0015
} // end of method Switch::SwitchInLoop
.method public hidebysig static void SwitchWithGoto(int32 i) cil managed
@ -891,7 +927,7 @@ @@ -891,7 +927,7 @@
.method public hidebysig static void SwitchOnStringInForLoop() cil managed
{
// Code size 303 (0x12f)
// Code size 299 (0x12b)
.maxstack 4
.locals init (class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty> V_0,
class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty> V_1,
@ -899,8 +935,7 @@ @@ -899,8 +935,7 @@
int32 V_3,
class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty V_4,
string V_5,
string V_6,
int32 V_7)
int32 V_6)
IL_0000: newobj instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::.ctor()
IL_0005: stloc.0
IL_0006: newobj instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::.ctor()
@ -909,7 +944,7 @@ @@ -909,7 +944,7 @@
IL_0011: stloc.2
IL_0012: ldc.i4.0
IL_0013: stloc.3
IL_0014: br IL_0125
IL_0014: br IL_0121
IL_0019: ldloc.2
IL_001a: ldloc.3
@ -918,119 +953,117 @@ @@ -918,119 +953,117 @@
IL_001e: ldloc.s V_4
IL_0020: ldfld class [mscorlib]System.Reflection.PropertyInfo ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::Property
IL_0025: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name()
IL_002a: stloc.s V_5
IL_002c: ldloc.s V_5
IL_002e: dup
IL_002f: stloc.s V_6
IL_0031: brfalse IL_0119
IL_0036: volatile.
IL_0038: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x600000e-1'
IL_003d: brtrue.s IL_0094
IL_003f: ldc.i4.6
IL_0040: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::.ctor(int32)
IL_0045: dup
IL_0046: ldstr "Name1"
IL_004b: ldc.i4.0
IL_004c: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_002a: dup
IL_002b: stloc.s V_5
IL_002d: brfalse IL_0115
IL_0032: volatile.
IL_0034: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x600000f-1'
IL_0039: brtrue.s IL_0090
IL_003b: ldc.i4.6
IL_003c: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::.ctor(int32)
IL_0041: dup
IL_0042: ldstr "Name1"
IL_0047: ldc.i4.0
IL_0048: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0051: dup
IL_0052: ldstr "Name2"
IL_0057: ldc.i4.1
IL_0058: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_004d: dup
IL_004e: ldstr "Name2"
IL_0053: ldc.i4.1
IL_0054: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_005d: dup
IL_005e: ldstr "Name3"
IL_0063: ldc.i4.2
IL_0064: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0059: dup
IL_005a: ldstr "Name3"
IL_005f: ldc.i4.2
IL_0060: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0069: dup
IL_006a: ldstr "Name4"
IL_006f: ldc.i4.3
IL_0070: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0065: dup
IL_0066: ldstr "Name4"
IL_006b: ldc.i4.3
IL_006c: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0075: dup
IL_0076: ldstr "Name5"
IL_007b: ldc.i4.4
IL_007c: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_0071: dup
IL_0072: ldstr "Name5"
IL_0077: ldc.i4.4
IL_0078: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_0081: dup
IL_0082: ldstr "Name6"
IL_0087: ldc.i4.5
IL_0088: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
IL_007d: dup
IL_007e: ldstr "Name6"
IL_0083: ldc.i4.5
IL_0084: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::Add(!0,
!1)
IL_008d: volatile.
IL_008f: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x600000e-1'
IL_0094: volatile.
IL_0096: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'::'$$method0x600000e-1'
IL_009b: ldloc.s V_6
IL_009d: ldloca.s V_7
IL_009f: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
IL_0089: volatile.
IL_008b: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x600000f-1'
IL_0090: volatile.
IL_0092: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'::'$$method0x600000f-1'
IL_0097: ldloc.s V_5
IL_0099: ldloca.s V_6
IL_009b: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32>::TryGetValue(!0,
!1&)
IL_00a4: brfalse.s IL_0119
IL_00a6: ldloc.s V_7
IL_00a8: switch (
IL_00c7,
IL_00d9,
IL_00eb,
IL_00fd,
IL_010f,
IL_010f)
IL_00c5: br.s IL_0119
IL_00c7: ldloc.s V_4
IL_00c9: ldc.i4.1
IL_00ca: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00cf: ldloc.0
IL_00d0: ldloc.s V_4
IL_00d2: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00d7: br.s IL_0121
IL_00d9: ldloc.s V_4
IL_00db: ldc.i4.2
IL_00dc: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00e1: ldloc.0
IL_00e2: ldloc.s V_4
IL_00e4: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00e9: br.s IL_0121
IL_00eb: ldloc.s V_4
IL_00ed: ldc.i4.3
IL_00ee: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00f3: ldloc.0
IL_00f4: ldloc.s V_4
IL_00f6: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00fb: br.s IL_0121
IL_00fd: ldloc.s V_4
IL_00ff: ldc.i4.4
IL_0100: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_0105: ldloc.0
IL_0106: ldloc.s V_4
IL_0108: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_010d: br.s IL_0121
IL_010f: ldloc.0
IL_0110: ldloc.s V_4
IL_0112: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_0117: br.s IL_0121
IL_0119: ldloc.1
IL_011a: ldloc.s V_4
IL_011c: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00a0: brfalse.s IL_0115
IL_00a2: ldloc.s V_6
IL_00a4: switch (
IL_00c3,
IL_00d5,
IL_00e7,
IL_00f9,
IL_010b,
IL_010b)
IL_00c1: br.s IL_0115
IL_00c3: ldloc.s V_4
IL_00c5: ldc.i4.1
IL_00c6: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00cb: ldloc.0
IL_00cc: ldloc.s V_4
IL_00ce: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00d3: br.s IL_011d
IL_00d5: ldloc.s V_4
IL_00d7: ldc.i4.2
IL_00d8: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00dd: ldloc.0
IL_00de: ldloc.s V_4
IL_00e0: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00e5: br.s IL_011d
IL_00e7: ldloc.s V_4
IL_00e9: ldc.i4.3
IL_00ea: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00ef: ldloc.0
IL_00f0: ldloc.s V_4
IL_00f2: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00f7: br.s IL_011d
IL_00f9: ldloc.s V_4
IL_00fb: ldc.i4.4
IL_00fc: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_0101: ldloc.0
IL_0102: ldloc.s V_4
IL_0104: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_0109: br.s IL_011d
IL_010b: ldloc.0
IL_010c: ldloc.s V_4
IL_010e: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_0113: br.s IL_011d
IL_0115: ldloc.1
IL_0116: ldloc.s V_4
IL_0118: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_011d: ldloc.3
IL_011e: ldc.i4.1
IL_011f: add
IL_0120: stloc.3
IL_0121: ldloc.3
IL_0122: ldc.i4.1
IL_0123: add
IL_0124: stloc.3
IL_0125: ldloc.3
IL_0126: ldloc.2
IL_0127: ldlen
IL_0128: conv.i4
IL_0129: blt IL_0019
IL_012e: ret
IL_0122: ldloc.2
IL_0123: ldlen
IL_0124: conv.i4
IL_0125: blt IL_0019
IL_012a: ret
} // end of method Switch::SwitchOnStringInForLoop
.method public hidebysig static void SwitchWithComplexCondition(string[] args) cil managed
@ -1157,14 +1190,14 @@ @@ -1157,14 +1190,14 @@
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
.class private auto ansi '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'
.class private auto ansi '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'
extends [mscorlib]System.Object
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x6000008-1'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x6000009-1'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x600000e-1'
} // end of class '<PrivateImplementationDetails>{2FE2A6DB-2DD1-4526-BE2D-8029A91D5DA5}'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x600000a-1'
.field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2<string,int32> '$$method0x600000f-1'
} // end of class '<PrivateImplementationDetails>{B84EA70D-C67F-455B-9708-0E39585F7DA1}'
// =============================================================

84
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.roslyn.il

@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module Switch.dll
// MVID: {94058166-F81D-4A82-ABCC-FB400C785214}
// MVID: {F38BF1C4-C0E5-4BAD-8838-849DFFFA97DF}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x00EF0000
// Image base: 0x00300000
// =============== CLASS MEMBERS DECLARATION ===================
@ -510,6 +510,46 @@ @@ -510,6 +510,46 @@
IL_0050: ret
} // end of method Switch::ShortSwitchOverString
.method public hidebysig static string
ShortSwitchOverStringWithNullCase(string text) cil managed
{
// Code size 71 (0x47)
.maxstack 2
IL_0000: ldstr "ShortSwitchOverStringWithNullCase: "
IL_0005: ldarg.0
IL_0006: call string [mscorlib]System.String::Concat(string,
string)
IL_000b: call void [mscorlib]System.Console::WriteLine(string)
IL_0010: ldarg.0
IL_0011: ldstr "First case"
IL_0016: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_001b: brtrue.s IL_002f
IL_001d: ldarg.0
IL_001e: ldstr "Second case"
IL_0023: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0028: brtrue.s IL_0035
IL_002a: ldarg.0
IL_002b: brfalse.s IL_003b
IL_002d: br.s IL_0041
IL_002f: ldstr "Text1"
IL_0034: ret
IL_0035: ldstr "Text2"
IL_003a: ret
IL_003b: ldstr "null"
IL_0040: ret
IL_0041: ldstr "Default"
IL_0046: ret
} // end of method Switch::ShortSwitchOverStringWithNullCase
.method public hidebysig static string
SwitchOverString1(string text) cil managed
{
@ -894,7 +934,7 @@ @@ -894,7 +934,7 @@
.method public hidebysig static void SwitchInLoop(int32 i) cil managed
{
// Code size 122 (0x7a)
// Code size 110 (0x6e)
.maxstack 2
IL_0000: ldstr "SwitchInLoop: "
IL_0005: ldarg.0
@ -908,37 +948,33 @@ @@ -908,37 +948,33 @@
IL_0018: switch (
IL_002f,
IL_003b,
IL_0047,
IL_0053)
IL_002d: br.s IL_005e
IL_0052,
IL_0047)
IL_002d: br.s IL_0052
IL_002f: ldstr "one"
IL_0034: call void [mscorlib]System.Console::WriteLine(string)
IL_0039: br.s IL_0073
IL_0039: br.s IL_0067
IL_003b: ldstr "two"
IL_0040: call void [mscorlib]System.Console::WriteLine(string)
IL_0045: br.s IL_0073
IL_0045: br.s IL_0067
IL_0047: ldstr "three"
IL_0047: ldstr "four"
IL_004c: call void [mscorlib]System.Console::WriteLine(string)
IL_0051: br.s IL_0015
IL_0053: ldstr "four"
IL_0058: call void [mscorlib]System.Console::WriteLine(string)
IL_005d: ret
IL_0051: ret
IL_005e: ldstr "default"
IL_0063: call void [mscorlib]System.Console::WriteLine(string)
IL_0068: ldstr "more code"
IL_006d: call void [mscorlib]System.Console::WriteLine(string)
IL_0072: ret
IL_0052: ldstr "default"
IL_0057: call void [mscorlib]System.Console::WriteLine(string)
IL_005c: ldstr "more code"
IL_0061: call void [mscorlib]System.Console::WriteLine(string)
IL_0066: ret
IL_0073: ldarg.0
IL_0074: ldc.i4.1
IL_0075: add
IL_0076: starg.s i
IL_0078: br.s IL_0015
IL_0067: ldarg.0
IL_0068: ldc.i4.1
IL_0069: add
IL_006a: starg.s i
IL_006c: br.s IL_0015
} // end of method Switch::SwitchInLoop
.method public hidebysig static void SwitchWithGoto(int32 i) cil managed

785
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.roslyn.il

@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module Switch.dll
// MVID: {1E0E6114-7796-44C6-B88B-AA126D09F561}
// MVID: {25920C54-28DD-4B8C-9EBF-16E716D0EC15}
.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 )
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x02FE0000
// Image base: 0x01040000
// =============== CLASS MEMBERS DECLARATION ===================
@ -683,6 +683,63 @@ @@ -683,6 +683,63 @@
IL_0062: ret
} // end of method Switch::ShortSwitchOverString
.method public hidebysig static string
ShortSwitchOverStringWithNullCase(string text) cil managed
{
// Code size 89 (0x59)
.maxstack 2
.locals init (string V_0,
string V_1)
IL_0000: nop
IL_0001: ldstr "ShortSwitchOverStringWithNullCase: "
IL_0006: ldarg.0
IL_0007: call string [mscorlib]System.String::Concat(string,
string)
IL_000c: call void [mscorlib]System.Console::WriteLine(string)
IL_0011: nop
IL_0012: ldarg.0
IL_0013: stloc.0
IL_0014: ldloc.0
IL_0015: ldstr "First case"
IL_001a: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_001f: brtrue.s IL_0033
IL_0021: ldloc.0
IL_0022: ldstr "Second case"
IL_0027: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_002c: brtrue.s IL_003c
IL_002e: ldloc.0
IL_002f: brfalse.s IL_0045
IL_0031: br.s IL_004e
IL_0033: nop
IL_0034: ldstr "Text1"
IL_0039: stloc.1
IL_003a: br.s IL_0057
IL_003c: nop
IL_003d: ldstr "Text2"
IL_0042: stloc.1
IL_0043: br.s IL_0057
IL_0045: nop
IL_0046: ldstr "null"
IL_004b: stloc.1
IL_004c: br.s IL_0057
IL_004e: nop
IL_004f: ldstr "Default"
IL_0054: stloc.1
IL_0055: br.s IL_0057
IL_0057: ldloc.1
IL_0058: ret
} // end of method Switch::ShortSwitchOverStringWithNullCase
.method public hidebysig static string
SwitchOverString1(string text) cil managed
{
@ -870,12 +927,11 @@ @@ -870,12 +927,11 @@
.method public hidebysig static string
SwitchOverString2() cil managed
{
// Code size 520 (0x208)
// Code size 518 (0x206)
.maxstack 2
.locals init (string V_0,
string V_1,
uint32 V_2,
string V_3)
uint32 V_1,
string V_2)
IL_0000: nop
IL_0001: ldstr "SwitchOverString2:"
IL_0006: call void [mscorlib]System.Console::WriteLine(string)
@ -883,238 +939,236 @@ @@ -883,238 +939,236 @@
IL_000c: call string [mscorlib]System.Environment::get_UserName()
IL_0011: stloc.0
IL_0012: ldloc.0
IL_0013: stloc.1
IL_0014: ldloc.1
IL_0015: call uint32 '<PrivateImplementationDetails>'::ComputeStringHash(string)
IL_001a: stloc.2
IL_001b: ldloc.2
IL_001c: ldc.i4 0x4c7c71f6
IL_0021: bgt.un.s IL_0072
IL_0013: call uint32 '<PrivateImplementationDetails>'::ComputeStringHash(string)
IL_0018: stloc.1
IL_0019: ldloc.1
IL_001a: ldc.i4 0x4c7c71f6
IL_001f: bgt.un.s IL_0070
IL_0023: ldloc.2
IL_0024: ldc.i4 0xc9a8f4f
IL_0029: bgt.un.s IL_0048
IL_0021: ldloc.1
IL_0022: ldc.i4 0xc9a8f4f
IL_0027: bgt.un.s IL_0046
IL_002b: ldloc.2
IL_002c: ldc.i4 0x8861b86
IL_0031: beq IL_011c
IL_0029: ldloc.1
IL_002a: ldc.i4 0x8861b86
IL_002f: beq IL_011a
IL_0036: br.s IL_0038
IL_0034: br.s IL_0036
IL_0038: ldloc.2
IL_0039: ldc.i4 0xc9a8f4f
IL_003e: beq IL_00c8
IL_0036: ldloc.1
IL_0037: ldc.i4 0xc9a8f4f
IL_003c: beq IL_00c6
IL_0043: br IL_01fd
IL_0041: br IL_01fb
IL_0048: ldloc.2
IL_0049: ldc.i4 0xf3d44a6
IL_004e: beq IL_00f2
IL_0046: ldloc.1
IL_0047: ldc.i4 0xf3d44a6
IL_004c: beq IL_00f0
IL_0053: br.s IL_0055
IL_0051: br.s IL_0053
IL_0055: ldloc.2
IL_0056: ldc.i4 0x20289804
IL_005b: beq IL_0158
IL_0053: ldloc.1
IL_0054: ldc.i4 0x20289804
IL_0059: beq IL_0156
IL_0060: br.s IL_0062
IL_005e: br.s IL_0060
IL_0062: ldloc.2
IL_0063: ldc.i4 0x4c7c71f6
IL_0068: beq IL_016a
IL_0060: ldloc.1
IL_0061: ldc.i4 0x4c7c71f6
IL_0066: beq IL_0168
IL_006d: br IL_01fd
IL_006b: br IL_01fb
IL_0072: ldloc.2
IL_0073: ldc.i4 0xa151b28a
IL_0078: bgt.un.s IL_00a4
IL_0070: ldloc.1
IL_0071: ldc.i4 0xa151b28a
IL_0076: bgt.un.s IL_00a2
IL_007a: ldloc.2
IL_007b: ldc.i4 0x4d0cea48
IL_0080: beq IL_018b
IL_0078: ldloc.1
IL_0079: ldc.i4 0x4d0cea48
IL_007e: beq IL_0189
IL_0085: br.s IL_0087
IL_0083: br.s IL_0085
IL_0087: ldloc.2
IL_0088: ldc.i4 0x51650fb9
IL_008d: beq IL_0131
IL_0085: ldloc.1
IL_0086: ldc.i4 0x51650fb9
IL_008b: beq IL_012f
IL_0092: br.s IL_0094
IL_0090: br.s IL_0092
IL_0094: ldloc.2
IL_0095: ldc.i4 0xa151b28a
IL_009a: beq IL_0146
IL_0092: ldloc.1
IL_0093: ldc.i4 0xa151b28a
IL_0098: beq IL_0144
IL_009f: br IL_01fd
IL_009d: br IL_01fb
IL_00a4: ldloc.2
IL_00a5: ldc.i4 0xea3d096b
IL_00aa: beq.s IL_00dd
IL_00a2: ldloc.1
IL_00a3: ldc.i4 0xea3d096b
IL_00a8: beq.s IL_00db
IL_00ac: br.s IL_00ae
IL_00aa: br.s IL_00ac
IL_00ae: ldloc.2
IL_00af: ldc.i4 0xed5134d4
IL_00b4: beq IL_017c
IL_00ac: ldloc.1
IL_00ad: ldc.i4 0xed5134d4
IL_00b2: beq IL_017a
IL_00b9: br.s IL_00bb
IL_00b7: br.s IL_00b9
IL_00bb: ldloc.2
IL_00bc: ldc.i4 0xf701cc7f
IL_00c1: beq.s IL_0107
IL_00b9: ldloc.1
IL_00ba: ldc.i4 0xf701cc7f
IL_00bf: beq.s IL_0105
IL_00c3: br IL_01fd
IL_00c1: br IL_01fb
IL_00c8: ldloc.1
IL_00c9: ldstr "First case"
IL_00ce: call bool [mscorlib]System.String::op_Equality(string,
IL_00c6: ldloc.0
IL_00c7: ldstr "First case"
IL_00cc: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_00d3: brtrue IL_019a
IL_00d1: brtrue IL_0198
IL_00d8: br IL_01fd
IL_00d6: br IL_01fb
IL_00dd: ldloc.1
IL_00de: ldstr "Second case"
IL_00e3: call bool [mscorlib]System.String::op_Equality(string,
IL_00db: ldloc.0
IL_00dc: ldstr "Second case"
IL_00e1: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_00e8: brtrue IL_01a3
IL_00e6: brtrue IL_01a1
IL_00ed: br IL_01fd
IL_00eb: br IL_01fb
IL_00f2: ldloc.1
IL_00f3: ldstr "Third case"
IL_00f8: call bool [mscorlib]System.String::op_Equality(string,
IL_00f0: ldloc.0
IL_00f1: ldstr "Third case"
IL_00f6: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_00fd: brtrue IL_01ac
IL_00fb: brtrue IL_01aa
IL_0102: br IL_01fd
IL_0100: br IL_01fb
IL_0107: ldloc.1
IL_0108: ldstr "Fourth case"
IL_010d: call bool [mscorlib]System.String::op_Equality(string,
IL_0105: ldloc.0
IL_0106: ldstr "Fourth case"
IL_010b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0112: brtrue IL_01b5
IL_0110: brtrue IL_01b3
IL_0117: br IL_01fd
IL_0115: br IL_01fb
IL_011c: ldloc.1
IL_011d: ldstr "Fifth case"
IL_0122: call bool [mscorlib]System.String::op_Equality(string,
IL_011a: ldloc.0
IL_011b: ldstr "Fifth case"
IL_0120: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0127: brtrue IL_01be
IL_0125: brtrue IL_01bc
IL_012c: br IL_01fd
IL_012a: br IL_01fb
IL_0131: ldloc.1
IL_0132: ldstr "Sixth case"
IL_0137: call bool [mscorlib]System.String::op_Equality(string,
IL_012f: ldloc.0
IL_0130: ldstr "Sixth case"
IL_0135: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_013c: brtrue IL_01c7
IL_013a: brtrue IL_01c5
IL_0141: br IL_01fd
IL_013f: br IL_01fb
IL_0146: ldloc.1
IL_0147: ldstr "Seventh case"
IL_014c: call bool [mscorlib]System.String::op_Equality(string,
IL_0144: ldloc.0
IL_0145: ldstr "Seventh case"
IL_014a: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0151: brtrue.s IL_01d0
IL_014f: brtrue.s IL_01ce
IL_0153: br IL_01fd
IL_0151: br IL_01fb
IL_0158: ldloc.1
IL_0159: ldstr "Eighth case"
IL_015e: call bool [mscorlib]System.String::op_Equality(string,
IL_0156: ldloc.0
IL_0157: ldstr "Eighth case"
IL_015c: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0163: brtrue.s IL_01d9
IL_0161: brtrue.s IL_01d7
IL_0165: br IL_01fd
IL_0163: br IL_01fb
IL_016a: ldloc.1
IL_016b: ldstr "Ninth case"
IL_0170: call bool [mscorlib]System.String::op_Equality(string,
IL_0168: ldloc.0
IL_0169: ldstr "Ninth case"
IL_016e: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0175: brtrue.s IL_01e2
IL_0173: brtrue.s IL_01e0
IL_0177: br IL_01fd
IL_0175: br IL_01fb
IL_017c: ldloc.1
IL_017d: ldstr "Tenth case"
IL_0182: call bool [mscorlib]System.String::op_Equality(string,
IL_017a: ldloc.0
IL_017b: ldstr "Tenth case"
IL_0180: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0187: brtrue.s IL_01eb
IL_0185: brtrue.s IL_01e9
IL_0189: br.s IL_01fd
IL_0187: br.s IL_01fb
IL_018b: ldloc.1
IL_018c: ldstr "Eleventh case"
IL_0191: call bool [mscorlib]System.String::op_Equality(string,
IL_0189: ldloc.0
IL_018a: ldstr "Eleventh case"
IL_018f: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0196: brtrue.s IL_01f4
IL_0198: br.s IL_01fd
IL_019a: nop
IL_019b: ldstr "Text1"
IL_01a0: stloc.3
IL_01a1: br.s IL_0206
IL_01a3: nop
IL_01a4: ldstr "Text2"
IL_01a9: stloc.3
IL_01aa: br.s IL_0206
IL_01ac: nop
IL_01ad: ldstr "Text3"
IL_01b2: stloc.3
IL_01b3: br.s IL_0206
IL_01b5: nop
IL_01b6: ldstr "Text4"
IL_01bb: stloc.3
IL_01bc: br.s IL_0206
IL_01be: nop
IL_01bf: ldstr "Text5"
IL_01c4: stloc.3
IL_01c5: br.s IL_0206
IL_01c7: nop
IL_01c8: ldstr "Text6"
IL_01cd: stloc.3
IL_01ce: br.s IL_0206
IL_01d0: nop
IL_01d1: ldstr "Text7"
IL_01d6: stloc.3
IL_01d7: br.s IL_0206
IL_01d9: nop
IL_01da: ldstr "Text8"
IL_01df: stloc.3
IL_01e0: br.s IL_0206
IL_01e2: nop
IL_01e3: ldstr "Text9"
IL_01e8: stloc.3
IL_01e9: br.s IL_0206
IL_01eb: nop
IL_01ec: ldstr "Text10"
IL_01f1: stloc.3
IL_01f2: br.s IL_0206
IL_01f4: nop
IL_01f5: ldstr "Text11"
IL_01fa: stloc.3
IL_01fb: br.s IL_0206
IL_01fd: nop
IL_01fe: ldstr "Default"
IL_0203: stloc.3
IL_0204: br.s IL_0206
IL_0206: ldloc.3
IL_0207: ret
IL_0194: brtrue.s IL_01f2
IL_0196: br.s IL_01fb
IL_0198: nop
IL_0199: ldstr "Text1"
IL_019e: stloc.2
IL_019f: br.s IL_0204
IL_01a1: nop
IL_01a2: ldstr "Text2"
IL_01a7: stloc.2
IL_01a8: br.s IL_0204
IL_01aa: nop
IL_01ab: ldstr "Text3"
IL_01b0: stloc.2
IL_01b1: br.s IL_0204
IL_01b3: nop
IL_01b4: ldstr "Text4"
IL_01b9: stloc.2
IL_01ba: br.s IL_0204
IL_01bc: nop
IL_01bd: ldstr "Text5"
IL_01c2: stloc.2
IL_01c3: br.s IL_0204
IL_01c5: nop
IL_01c6: ldstr "Text6"
IL_01cb: stloc.2
IL_01cc: br.s IL_0204
IL_01ce: nop
IL_01cf: ldstr "Text7"
IL_01d4: stloc.2
IL_01d5: br.s IL_0204
IL_01d7: nop
IL_01d8: ldstr "Text8"
IL_01dd: stloc.2
IL_01de: br.s IL_0204
IL_01e0: nop
IL_01e1: ldstr "Text9"
IL_01e6: stloc.2
IL_01e7: br.s IL_0204
IL_01e9: nop
IL_01ea: ldstr "Text10"
IL_01ef: stloc.2
IL_01f0: br.s IL_0204
IL_01f2: nop
IL_01f3: ldstr "Text11"
IL_01f8: stloc.2
IL_01f9: br.s IL_0204
IL_01fb: nop
IL_01fc: ldstr "Default"
IL_0201: stloc.2
IL_0202: br.s IL_0204
IL_0204: ldloc.2
IL_0205: ret
} // end of method Switch::SwitchOverString2
.method public hidebysig static string
@ -1166,7 +1220,7 @@ @@ -1166,7 +1220,7 @@
.method public hidebysig static void SwitchInLoop(int32 i) cil managed
{
// Code size 146 (0x92)
// Code size 132 (0x84)
.maxstack 2
.locals init (int32 V_0,
bool V_1)
@ -1178,7 +1232,7 @@ @@ -1178,7 +1232,7 @@
object)
IL_0011: call void [mscorlib]System.Console::WriteLine(string)
IL_0016: nop
IL_0017: br.s IL_008d
IL_0017: br.s IL_007f
IL_0019: nop
IL_001a: ldarg.0
@ -1189,53 +1243,47 @@ @@ -1189,53 +1243,47 @@
IL_001f: switch (
IL_0036,
IL_0044,
IL_0052,
IL_0060)
IL_0034: br.s IL_006e
IL_0060,
IL_0052)
IL_0034: br.s IL_0060
IL_0036: nop
IL_0037: ldstr "one"
IL_003c: call void [mscorlib]System.Console::WriteLine(string)
IL_0041: nop
IL_0042: br.s IL_0087
IL_0042: br.s IL_0079
IL_0044: nop
IL_0045: ldstr "two"
IL_004a: call void [mscorlib]System.Console::WriteLine(string)
IL_004f: nop
IL_0050: br.s IL_0087
IL_0050: br.s IL_0079
IL_0052: nop
IL_0053: ldstr "three"
IL_0053: ldstr "four"
IL_0058: call void [mscorlib]System.Console::WriteLine(string)
IL_005d: nop
IL_005e: br.s IL_008d
IL_005e: br.s IL_0083
IL_0060: nop
IL_0061: ldstr "four"
IL_0061: ldstr "default"
IL_0066: call void [mscorlib]System.Console::WriteLine(string)
IL_006b: nop
IL_006c: br.s IL_0091
IL_006e: nop
IL_006f: ldstr "default"
IL_0074: call void [mscorlib]System.Console::WriteLine(string)
IL_0079: nop
IL_007a: ldstr "more code"
IL_007f: call void [mscorlib]System.Console::WriteLine(string)
IL_0084: nop
IL_0085: br.s IL_0091
IL_0087: ldarg.0
IL_0088: ldc.i4.1
IL_0089: add
IL_008a: starg.s i
IL_008c: nop
IL_008d: ldc.i4.1
IL_008e: stloc.1
IL_008f: br.s IL_0019
IL_0091: ret
IL_006c: ldstr "more code"
IL_0071: call void [mscorlib]System.Console::WriteLine(string)
IL_0076: nop
IL_0077: br.s IL_0083
IL_0079: ldarg.0
IL_007a: ldc.i4.1
IL_007b: add
IL_007c: starg.s i
IL_007e: nop
IL_007f: ldc.i4.1
IL_0080: stloc.1
IL_0081: br.s IL_0019
IL_0083: ret
} // end of method Switch::SwitchInLoop
.method public hidebysig static void SwitchWithGoto(int32 i) cil managed
@ -1317,7 +1365,7 @@ @@ -1317,7 +1365,7 @@
.method public hidebysig static void SwitchOnStringInForLoop() cil managed
{
// Code size 265 (0x109)
// Code size 261 (0x105)
.maxstack 2
.locals init (class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty> V_0,
class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty> V_1,
@ -1325,8 +1373,7 @@ @@ -1325,8 +1373,7 @@
int32 V_3,
class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty V_4,
string V_5,
string V_6,
bool V_7)
bool V_6)
IL_0000: nop
IL_0001: newobj instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::.ctor()
IL_0006: stloc.0
@ -1336,7 +1383,7 @@ @@ -1336,7 +1383,7 @@
IL_0012: stloc.2
IL_0013: ldc.i4.0
IL_0014: stloc.3
IL_0015: br IL_00f9
IL_0015: br IL_00f5
IL_001a: nop
IL_001b: ldloc.2
@ -1348,123 +1395,121 @@ @@ -1348,123 +1395,121 @@
IL_0027: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name()
IL_002c: stloc.s V_5
IL_002e: ldloc.s V_5
IL_0030: stloc.s V_6
IL_0032: ldloc.s V_6
IL_0034: ldstr "Name1"
IL_0039: call bool [mscorlib]System.String::op_Equality(string,
IL_0030: ldstr "Name1"
IL_0035: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_003e: brtrue.s IL_0088
IL_003a: brtrue.s IL_0084
IL_0040: ldloc.s V_6
IL_0042: ldstr "Name2"
IL_0047: call bool [mscorlib]System.String::op_Equality(string,
IL_003c: ldloc.s V_5
IL_003e: ldstr "Name2"
IL_0043: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_004c: brtrue.s IL_009d
IL_0048: brtrue.s IL_0099
IL_004e: ldloc.s V_6
IL_0050: ldstr "Name3"
IL_0055: call bool [mscorlib]System.String::op_Equality(string,
IL_004a: ldloc.s V_5
IL_004c: ldstr "Name3"
IL_0051: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_005a: brtrue.s IL_00b2
IL_0056: brtrue.s IL_00ae
IL_005c: ldloc.s V_6
IL_005e: ldstr "Name4"
IL_0063: call bool [mscorlib]System.String::op_Equality(string,
IL_0058: ldloc.s V_5
IL_005a: ldstr "Name4"
IL_005f: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0068: brtrue.s IL_00c7
IL_0064: brtrue.s IL_00c3
IL_006a: ldloc.s V_6
IL_006c: ldstr "Name5"
IL_0071: call bool [mscorlib]System.String::op_Equality(string,
IL_0066: ldloc.s V_5
IL_0068: ldstr "Name5"
IL_006d: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0076: brtrue.s IL_00dc
IL_0072: brtrue.s IL_00d8
IL_0078: ldloc.s V_6
IL_007a: ldstr "Name6"
IL_007f: call bool [mscorlib]System.String::op_Equality(string,
IL_0074: ldloc.s V_5
IL_0076: ldstr "Name6"
IL_007b: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0084: brtrue.s IL_00dc
IL_0080: brtrue.s IL_00d8
IL_0086: br.s IL_00e8
IL_0082: br.s IL_00e4
IL_0088: nop
IL_0089: ldloc.s V_4
IL_008b: ldc.i4.1
IL_008c: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_0091: nop
IL_0092: ldloc.0
IL_0093: ldloc.s V_4
IL_0095: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_009a: nop
IL_009b: br.s IL_00f4
IL_009d: nop
IL_009e: ldloc.s V_4
IL_00a0: ldc.i4.2
IL_00a1: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00a6: nop
IL_00a7: ldloc.0
IL_00a8: ldloc.s V_4
IL_00aa: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00af: nop
IL_00b0: br.s IL_00f4
IL_00b2: nop
IL_00b3: ldloc.s V_4
IL_00b5: ldc.i4.3
IL_00b6: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00bb: nop
IL_00bc: ldloc.0
IL_00bd: ldloc.s V_4
IL_00bf: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00c4: nop
IL_00c5: br.s IL_00f4
IL_00c7: nop
IL_00c8: ldloc.s V_4
IL_00ca: ldc.i4.4
IL_00cb: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00d0: nop
IL_00d1: ldloc.0
IL_00d2: ldloc.s V_4
IL_00d4: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00d9: nop
IL_00da: br.s IL_00f4
IL_00dc: nop
IL_00dd: ldloc.0
IL_00de: ldloc.s V_4
IL_00e0: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00e5: nop
IL_00e6: br.s IL_00f4
IL_00e8: nop
IL_00e9: ldloc.1
IL_00ea: ldloc.s V_4
IL_00ec: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00f1: nop
IL_00f2: br.s IL_00f4
IL_00f4: nop
IL_0084: nop
IL_0085: ldloc.s V_4
IL_0087: ldc.i4.1
IL_0088: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_008d: nop
IL_008e: ldloc.0
IL_008f: ldloc.s V_4
IL_0091: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_0096: nop
IL_0097: br.s IL_00f0
IL_0099: nop
IL_009a: ldloc.s V_4
IL_009c: ldc.i4.2
IL_009d: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00a2: nop
IL_00a3: ldloc.0
IL_00a4: ldloc.s V_4
IL_00a6: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00ab: nop
IL_00ac: br.s IL_00f0
IL_00ae: nop
IL_00af: ldloc.s V_4
IL_00b1: ldc.i4.3
IL_00b2: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00b7: nop
IL_00b8: ldloc.0
IL_00b9: ldloc.s V_4
IL_00bb: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00c0: nop
IL_00c1: br.s IL_00f0
IL_00c3: nop
IL_00c4: ldloc.s V_4
IL_00c6: ldc.i4.4
IL_00c7: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
IL_00cc: nop
IL_00cd: ldloc.0
IL_00ce: ldloc.s V_4
IL_00d0: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00d5: nop
IL_00d6: br.s IL_00f0
IL_00d8: nop
IL_00d9: ldloc.0
IL_00da: ldloc.s V_4
IL_00dc: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00e1: nop
IL_00e2: br.s IL_00f0
IL_00e4: nop
IL_00e5: ldloc.1
IL_00e6: ldloc.s V_4
IL_00e8: callvirt instance void class [mscorlib]System.Collections.Generic.List`1<class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty>::Add(!0)
IL_00ed: nop
IL_00ee: br.s IL_00f0
IL_00f0: nop
IL_00f1: ldloc.3
IL_00f2: ldc.i4.1
IL_00f3: add
IL_00f4: stloc.3
IL_00f5: ldloc.3
IL_00f6: ldc.i4.1
IL_00f7: add
IL_00f8: stloc.3
IL_00f9: ldloc.3
IL_00fa: ldloc.2
IL_00fb: ldlen
IL_00fc: conv.i4
IL_00fd: clt
IL_00ff: stloc.s V_7
IL_0101: ldloc.s V_7
IL_0103: brtrue IL_001a
IL_0108: ret
IL_00f6: ldloc.2
IL_00f7: ldlen
IL_00f8: conv.i4
IL_00f9: clt
IL_00fb: stloc.s V_6
IL_00fd: ldloc.s V_6
IL_00ff: brtrue IL_001a
IL_0104: ret
} // end of method Switch::SwitchOnStringInForLoop
.method public hidebysig static void SwitchWithComplexCondition(string[] args) cil managed
{
// Code size 134 (0x86)
// Code size 138 (0x8a)
.maxstack 2
.locals init (string V_0)
IL_0000: nop
@ -1489,51 +1534,55 @@ @@ -1489,51 +1534,55 @@
IL_001e: ldstr "b"
IL_0023: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0028: brtrue.s IL_0053
IL_0028: brtrue.s IL_0054
IL_002a: ldloc.0
IL_002b: ldstr "c"
IL_0030: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0035: brtrue.s IL_0060
IL_0035: brtrue.s IL_0062
IL_0037: ldloc.0
IL_0038: ldstr "d"
IL_003d: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0042: brtrue.s IL_006d
IL_0042: brtrue.s IL_0070
IL_0044: br.s IL_007a
IL_0044: br.s IL_007e
IL_0046: ldstr "a"
IL_004b: call void [mscorlib]System.Console::WriteLine(string)
IL_0050: nop
IL_0051: br.s IL_007a
IL_0046: nop
IL_0047: ldstr "a"
IL_004c: call void [mscorlib]System.Console::WriteLine(string)
IL_0051: nop
IL_0052: br.s IL_007e
IL_0053: ldstr "b"
IL_0058: call void [mscorlib]System.Console::WriteLine(string)
IL_005d: nop
IL_005e: br.s IL_007a
IL_0054: nop
IL_0055: ldstr "b"
IL_005a: call void [mscorlib]System.Console::WriteLine(string)
IL_005f: nop
IL_0060: br.s IL_007e
IL_0060: ldstr "c"
IL_0065: call void [mscorlib]System.Console::WriteLine(string)
IL_006a: nop
IL_006b: br.s IL_007a
IL_0062: nop
IL_0063: ldstr "c"
IL_0068: call void [mscorlib]System.Console::WriteLine(string)
IL_006d: nop
IL_006e: br.s IL_007e
IL_006d: ldstr "d"
IL_0072: call void [mscorlib]System.Console::WriteLine(string)
IL_0077: nop
IL_0078: br.s IL_007a
IL_0070: nop
IL_0071: ldstr "d"
IL_0076: call void [mscorlib]System.Console::WriteLine(string)
IL_007b: nop
IL_007c: br.s IL_007e
IL_007a: ldstr "end"
IL_007f: call void [mscorlib]System.Console::WriteLine(string)
IL_0084: nop
IL_0085: ret
IL_007e: ldstr "end"
IL_0083: call void [mscorlib]System.Console::WriteLine(string)
IL_0088: nop
IL_0089: ret
} // end of method Switch::SwitchWithComplexCondition
.method public hidebysig static void SwitchWithArray(string[] args) cil managed
{
// Code size 123 (0x7b)
// Code size 127 (0x7f)
.maxstack 2
.locals init (string V_0)
IL_0000: nop
@ -1551,46 +1600,50 @@ @@ -1551,46 +1600,50 @@
IL_0013: ldstr "b"
IL_0018: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_001d: brtrue.s IL_0048
IL_001d: brtrue.s IL_0049
IL_001f: ldloc.0
IL_0020: ldstr "c"
IL_0025: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_002a: brtrue.s IL_0055
IL_002a: brtrue.s IL_0057
IL_002c: ldloc.0
IL_002d: ldstr "d"
IL_0032: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0037: brtrue.s IL_0062
IL_0039: br.s IL_006f
IL_0037: brtrue.s IL_0065
IL_003b: ldstr "a"
IL_0040: call void [mscorlib]System.Console::WriteLine(string)
IL_0045: nop
IL_0046: br.s IL_006f
IL_0039: br.s IL_0073
IL_0048: ldstr "b"
IL_004d: call void [mscorlib]System.Console::WriteLine(string)
IL_0052: nop
IL_0053: br.s IL_006f
IL_003b: nop
IL_003c: ldstr "a"
IL_0041: call void [mscorlib]System.Console::WriteLine(string)
IL_0046: nop
IL_0047: br.s IL_0073
IL_0055: ldstr "c"
IL_005a: call void [mscorlib]System.Console::WriteLine(string)
IL_005f: nop
IL_0060: br.s IL_006f
IL_0049: nop
IL_004a: ldstr "b"
IL_004f: call void [mscorlib]System.Console::WriteLine(string)
IL_0054: nop
IL_0055: br.s IL_0073
IL_0062: ldstr "d"
IL_0067: call void [mscorlib]System.Console::WriteLine(string)
IL_006c: nop
IL_006d: br.s IL_006f
IL_0057: nop
IL_0058: ldstr "c"
IL_005d: call void [mscorlib]System.Console::WriteLine(string)
IL_0062: nop
IL_0063: br.s IL_0073
IL_006f: ldstr "end"
IL_0074: call void [mscorlib]System.Console::WriteLine(string)
IL_0079: nop
IL_007a: ret
IL_0065: nop
IL_0066: ldstr "d"
IL_006b: call void [mscorlib]System.Console::WriteLine(string)
IL_0070: nop
IL_0071: br.s IL_0073
IL_0073: ldstr "end"
IL_0078: call void [mscorlib]System.Console::WriteLine(string)
IL_007d: nop
IL_007e: ret
} // end of method Switch::SwitchWithArray
} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch

Loading…
Cancel
Save