diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
index 9227073bd..490bc4c50 100644
--- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
+++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
@@ -105,6 +105,7 @@
+
diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
index 483e1f3b0..6e340a2d3 100644
--- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
+++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
@@ -97,6 +97,12 @@ namespace ICSharpCode.Decompiler.Tests
Run(cscOptions: cscOptions);
}
+ [Test]
+ public void Switch([ValueSource("defaultOptions")] CompilerOptions cscOptions)
+ {
+ Run(cscOptions: cscOptions);
+ }
+
[Test]
public void DelegateConstruction([ValueSource("defaultOptions")] CompilerOptions cscOptions)
{
diff --git a/ICSharpCode.Decompiler.Tests/Switch.cs b/ICSharpCode.Decompiler.Tests/Switch.cs
deleted file mode 100644
index 4a20a6392..000000000
--- a/ICSharpCode.Decompiler.Tests/Switch.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this
-// software and associated documentation files (the "Software"), to deal in the Software
-// without restriction, including without limitation the rights to use, copy, modify, merge,
-// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
-// to whom the Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or
-// substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-
-using System;
-
-public static class Switch
-{
- public static string ShortSwitchOverString(string text)
- {
- switch (text) {
- case "First case":
- return "Text";
- default:
- return "Default";
- }
- }
-
- public static string SwitchOverString1(string text)
- {
- switch (text)
- {
- case "First case":
- return "Text1";
- case "Second case":
- case "2nd case":
- return "Text2";
- case "Third case":
- return "Text3";
- case "Fourth case":
- return "Text4";
- case "Fifth case":
- return "Text5";
- case "Sixth case":
- return "Text6";
- case null:
- return null;
- default:
- return "Default";
- }
- }
-
- public static string SwitchOverString2()
- {
- switch (Environment.UserName)
- {
- case "First case":
- return "Text1";
- case "Second case":
- return "Text2";
- case "Third case":
- return "Text3";
- case "Fourth case":
- return "Text4";
- case "Fifth case":
- return "Text5";
- case "Sixth case":
- return "Text6";
- default:
- return "Default";
- }
- }
-
- public static string SwitchOverBool(bool b)
- {
- switch (b) {
- case true:
- return bool.TrueString;
- case false:
- return bool.FalseString;
- default:
- return null;
- }
- }
-}
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/LINQRaytracer.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/LINQRaytracer.cs
index 3a2808a6c..c18201788 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/LINQRaytracer.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/LINQRaytracer.cs
@@ -10,8 +10,8 @@ namespace RayTracer
{
static void Main()
{
- const int width = 600;
- const int height = 600;
+ const int width = 50;
+ const int height = 50;
RayTracer rayTracer = new RayTracer(width, height, (int x, int y, Color color) => {
Console.Write("{0},{1}:{2};", x, y, color);
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs
index 61ed2f347..f28e691cf 100644
--- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs
@@ -26,10 +26,17 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
{
TestCase(SparseIntegerSwitch, -100, 1, 2, 3, 4);
TestCase(ShortSwitchOverString, "First case", "Else");
+ TestCase(ShortSwitchOverString2, "First case", "Second case", "Third case", "Else");
+ TestCase(ShortSwitchOverStringNoExplicitDefault, "First case", "Second case", "Third case", "Else");
TestCase(SwitchOverString1, "First case", "Second case", "2nd case", "Third case", "Fourth case", "Fifth case", "Sixth case", null, "default", "else");
Console.WriteLine(SwitchOverString2());
Console.WriteLine(SwitchOverBool(true));
Console.WriteLine(SwitchOverBool(false));
+ SwitchInLoop(0);
+ SwitchWithGoto(1);
+ SwitchWithGoto(2);
+ SwitchWithGoto(3);
+ SwitchWithGoto(4);
}
static void TestCase(Func target, params T[] args)
@@ -41,6 +48,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
public static string SparseIntegerSwitch(int i)
{
+ Console.WriteLine("SparseIntegerSwitch: " + i);
switch (i) {
case -10000000: return "-10 mln";
case -100: return "-hundred";
@@ -59,6 +67,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
public static string ShortSwitchOverString(string text)
{
+ Console.WriteLine("ShortSwitchOverString: " + text);
switch (text) {
case "First case":
return "Text";
@@ -67,8 +76,38 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
}
+ public static string ShortSwitchOverString2(string text)
+ {
+ Console.WriteLine("ShortSwitchOverString2: " + text);
+ switch (text) {
+ case "First case":
+ return "Text1";
+ case "Second case":
+ return "Text2";
+ case "Third case":
+ return "Text3";
+ default:
+ return "Default";
+ }
+ }
+
+ public static string ShortSwitchOverStringNoExplicitDefault(string text)
+ {
+ Console.WriteLine("ShortSwitchOverStringNoExplicitDefault: " + text);
+ switch (text) {
+ case "First case":
+ return "Text1";
+ case "Second case":
+ return "Text2";
+ case "Third case":
+ return "Text3";
+ }
+ return "Default";
+ }
+
public static string SwitchOverString1(string text)
{
+ Console.WriteLine("SwitchOverString1: " + text);
switch (text) {
case "First case":
return "Text1";
@@ -92,6 +131,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
public static string SwitchOverString2()
{
+ Console.WriteLine("SwitchOverString2:");
switch (Environment.UserName) {
case "First case":
return "Text1";
@@ -105,6 +145,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
return "Text5";
case "Sixth case":
return "Text6";
+ case "Seventh case":
+ return "Text7";
+ case "Eighth case":
+ return "Text8";
+ case "Ninth case":
+ return "Text9";
+ case "Tenth case":
+ return "Text10";
+ case "Eleventh case":
+ return "Text11";
default:
return "Default";
}
@@ -112,6 +162,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
public static string SwitchOverBool(bool b)
{
+ Console.WriteLine("SwitchOverBool: " + b);
switch (b) {
case true:
return bool.TrueString;
@@ -124,6 +175,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
public static void SwitchInLoop(int i)
{
+ Console.WriteLine("SwitchInLoop: " + i);
while (true) {
switch (i) {
case 1:
@@ -141,10 +193,32 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
default:
Console.WriteLine("default");
Console.WriteLine("more code");
- throw new ArgumentException();
+ return;
}
i++;
}
}
+
+ public static void SwitchWithGoto(int i)
+ {
+ Console.WriteLine("SwitchWithGoto: " + i);
+ switch (i) {
+ case 1:
+ Console.WriteLine("one");
+ goto default;
+ case 2:
+ Console.WriteLine("two");
+ goto case 3;
+ case 3:
+ Console.WriteLine("three");
+ break;
+ case 4:
+ Console.WriteLine("four");
+ return;
+ default:
+ Console.WriteLine("default");
+ break;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs
new file mode 100644
index 000000000..1f6ec6f17
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs
@@ -0,0 +1,415 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
+{
+ public static class Switch
+ {
+ public class SetProperty
+ {
+ public readonly PropertyInfo Property;
+
+ public int Set {
+ get;
+ set;
+ }
+
+ public SetProperty(PropertyInfo property)
+ {
+ this.Property = property;
+ }
+ }
+
+ public static string SparseIntegerSwitch(int i)
+ {
+ Console.WriteLine("SparseIntegerSwitch: " + i);
+ switch (i) {
+ case -10000000:
+ return "-10 mln";
+ case -100:
+ return "-hundred";
+ case -1:
+ return "-1";
+ case 0:
+ return "0";
+ case 1:
+ return "1";
+ case 2:
+ return "2";
+ case 4:
+ return "4";
+ case 100:
+ return "hundred";
+ case 10000:
+ return "ten thousand";
+ case 10001:
+ return "ten thousand and one";
+ case 2147483647:
+ return "int.MaxValue";
+ default:
+ return "something else";
+ }
+ }
+
+ public static string SwitchOverNullableInt(int? i)
+ {
+ switch (i) {
+ case null:
+ return "null";
+ case 0:
+ return "zero";
+ case 5:
+ return "five";
+ case 10:
+ return "ten";
+ default:
+ return "large";
+ }
+ }
+
+ public static string SwitchOverNullableIntNullCaseCombined(int? i)
+ {
+ switch (i) {
+ case null:
+ case 0:
+ return "zero";
+ case 5:
+ return "five";
+ case 10:
+ return "ten";
+ default:
+ return "large";
+ }
+ }
+
+ public static string SwitchOverNullableIntShifted(int? i)
+ {
+ switch (i + 5) {
+ case null:
+ return "null";
+ case 0:
+ return "zero";
+ case 5:
+ return "five";
+ case 10:
+ return "ten";
+ default:
+ return "large";
+ }
+ }
+
+ public static string SwitchOverNullableIntShiftedNullCaseCombined(int? i)
+ {
+ switch (i + 5) {
+ case null:
+ case 0:
+ return "zero";
+ case 5:
+ return "five";
+ case 10:
+ return "ten";
+ default:
+ return "large";
+ }
+ }
+
+ public static string SwitchOverNullableIntNoNullCase(int? i)
+ {
+ switch (i) {
+ case 0:
+ return "zero";
+ case 5:
+ return "five";
+ case 10:
+ return "ten";
+ default:
+ return "other";
+ }
+ }
+
+ public static string SwitchOverNullableIntNoNullCaseShifted(int? i)
+ {
+ switch (i + 5) {
+ case 0:
+ return "zero";
+ case 5:
+ return "five";
+ case 10:
+ return "ten";
+ default:
+ return "other";
+ }
+ }
+
+ public static void SwitchOverInt(int i)
+ {
+ switch (i) {
+ case 0:
+ Console.WriteLine("zero");
+ break;
+ case 5:
+ Console.WriteLine("five");
+ break;
+ case 10:
+ Console.WriteLine("ten");
+ break;
+ case 15:
+ Console.WriteLine("fifteen");
+ break;
+ case 20:
+ Console.WriteLine("twenty");
+ break;
+ case 25:
+ Console.WriteLine("twenty-five");
+ break;
+ case 30:
+ Console.WriteLine("thirty");
+ break;
+ }
+ }
+
+ public static string ShortSwitchOverString(string text)
+ {
+ Console.WriteLine("ShortSwitchOverString: " + text);
+ switch (text) {
+ case "First case":
+ return "Text1";
+ case "Second case":
+ return "Text2";
+ case "Third case":
+ return "Text3";
+ default:
+ return "Default";
+ }
+ }
+
+ public static string ShortSwitchOverStringWithNullCase(string text)
+ {
+ Console.WriteLine("ShortSwitchOverStringWithNullCase: " + text);
+ switch (text) {
+ case "First case":
+ return "Text1";
+ case "Second case":
+ return "Text2";
+ case null:
+ return "null";
+ default:
+ return "Default";
+ }
+ }
+
+ public static string SwitchOverString1(string text)
+ {
+ Console.WriteLine("SwitchOverString1: " + text);
+ switch (text) {
+ case "First case":
+ return "Text1";
+ case "Second case":
+ case "2nd case":
+ return "Text2";
+ case "Third case":
+ return "Text3";
+ case "Fourth case":
+ return "Text4";
+ case "Fifth case":
+ return "Text5";
+ case "Sixth case":
+ return "Text6";
+ case null:
+ return null;
+ default:
+ return "Default";
+ }
+ }
+
+ public static string SwitchOverString2()
+ {
+ Console.WriteLine("SwitchOverString2:");
+ switch (Environment.UserName) {
+ case "First case":
+ return "Text1";
+ case "Second case":
+ return "Text2";
+ case "Third case":
+ return "Text3";
+ case "Fourth case":
+ return "Text4";
+ case "Fifth case":
+ return "Text5";
+ case "Sixth case":
+ return "Text6";
+ case "Seventh case":
+ return "Text7";
+ case "Eighth case":
+ return "Text8";
+ case "Ninth case":
+ return "Text9";
+ case "Tenth case":
+ return "Text10";
+ case "Eleventh case":
+ return "Text11";
+ default:
+ return "Default";
+ }
+ }
+
+ public static string SwitchOverBool(bool b)
+ {
+ Console.WriteLine("SwitchOverBool: " + b.ToString());
+ switch (b) {
+ case true:
+ return bool.TrueString;
+ case false:
+ return bool.FalseString;
+ default:
+ return null;
+ }
+ }
+
+ public static void SwitchInLoop(int i)
+ {
+ Console.WriteLine("SwitchInLoop: " + i);
+ while (true) {
+ switch (i) {
+ case 1:
+ Console.WriteLine("one");
+ break;
+ case 2:
+ Console.WriteLine("two");
+ break;
+ //case 3:
+ // Console.WriteLine("three");
+ // continue;
+ case 4:
+ Console.WriteLine("four");
+ return;
+ default:
+ Console.WriteLine("default");
+ Console.WriteLine("more code");
+ return;
+ }
+ i++;
+ }
+ }
+
+ public static void SwitchWithGoto(int i)
+ {
+ Console.WriteLine("SwitchWithGoto: " + i);
+ switch (i) {
+ case 1:
+ Console.WriteLine("one");
+ goto default;
+ case 2:
+ Console.WriteLine("two");
+ goto case 3;
+ case 3:
+ Console.WriteLine("three");
+ break;
+ case 4:
+ Console.WriteLine("four");
+ return;
+ default:
+ Console.WriteLine("default");
+ break;
+ }
+ Console.WriteLine("End of method");
+ }
+
+ private static SetProperty[] GetProperties()
+ {
+ return new SetProperty[0];
+ }
+
+ public static void SwitchOnStringInForLoop()
+ {
+ List list = new List();
+ List list2 = new List();
+ SetProperty[] properties = Switch.GetProperties();
+ for (int i = 0; i < properties.Length; i++) {
+ SetProperty setProperty = properties[i];
+ switch (setProperty.Property.Name) {
+ case "Name1":
+ setProperty.Set = 1;
+ list.Add(setProperty);
+ break;
+ case "Name2":
+ setProperty.Set = 2;
+ list.Add(setProperty);
+ break;
+ case "Name3":
+ setProperty.Set = 3;
+ list.Add(setProperty);
+ break;
+ case "Name4":
+ setProperty.Set = 4;
+ list.Add(setProperty);
+ break;
+ case "Name5":
+ case "Name6":
+ list.Add(setProperty);
+ break;
+ default:
+ list2.Add(setProperty);
+ break;
+ }
+ }
+ }
+
+ public static void SwitchWithComplexCondition(string[] args)
+ {
+ switch ((args.Length == 0) ? "dummy" : args[0]) {
+ case "a":
+ Console.WriteLine("a");
+ break;
+ case "b":
+ Console.WriteLine("b");
+ break;
+ case "c":
+ Console.WriteLine("c");
+ break;
+ case "d":
+ Console.WriteLine("d");
+ break;
+ }
+ Console.WriteLine("end");
+ }
+
+ public static void SwitchWithArray(string[] args)
+ {
+ switch (args[0]) {
+ case "a":
+ Console.WriteLine("a");
+ break;
+ case "b":
+ Console.WriteLine("b");
+ break;
+ case "c":
+ Console.WriteLine("c");
+ break;
+ case "d":
+ Console.WriteLine("d");
+ break;
+ }
+ Console.WriteLine("end");
+ }
+ }
+}
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.il
new file mode 100644
index 000000000..40a21bc93
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.il
@@ -0,0 +1,1529 @@
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
+// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
+
+
+
+// Metadata version: v4.0.30319
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly '4doqvnxq'
+{
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
+ .permissionset reqmin
+ = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module '4doqvnxq.dll'
+// MVID: {5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}
+.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: 0x03320000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
+ extends [mscorlib]System.Object
+{
+ .class auto ansi nested public beforefieldinit SetProperty
+ extends [mscorlib]System.Object
+ {
+ .field public initonly class [mscorlib]System.Reflection.PropertyInfo Property
+ .field private int32 'k__BackingField'
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .method public hidebysig specialname
+ instance int32 get_Set() cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 11 (0xb)
+ .maxstack 1
+ .locals init (int32 V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::'k__BackingField'
+ IL_0006: stloc.0
+ IL_0007: br.s IL_0009
+
+ IL_0009: ldloc.0
+ IL_000a: ret
+ } // end of method SetProperty::get_Set
+
+ .method public hidebysig specialname
+ instance void set_Set(int32 'value') cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 8 (0x8)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::'k__BackingField'
+ IL_0007: ret
+ } // end of method SetProperty::set_Set
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(class [mscorlib]System.Reflection.PropertyInfo 'property') cil managed
+ {
+ // Code size 17 (0x11)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: nop
+ IL_0007: nop
+ IL_0008: ldarg.0
+ IL_0009: ldarg.1
+ IL_000a: stfld class [mscorlib]System.Reflection.PropertyInfo ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::Property
+ IL_000f: nop
+ IL_0010: ret
+ } // end of method SetProperty::.ctor
+
+ .property instance int32 Set()
+ {
+ .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::get_Set()
+ .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
+ } // end of property SetProperty::Set
+ } // end of class SetProperty
+
+ .method public hidebysig static string
+ SparseIntegerSwitch(int32 i) cil managed
+ {
+ // Code size 209 (0xd1)
+ .maxstack 2
+ .locals init (string V_0,
+ int32 V_1)
+ IL_0000: nop
+ IL_0001: ldstr "SparseIntegerSwitch: "
+ IL_0006: ldarg.0
+ IL_0007: box [mscorlib]System.Int32
+ IL_000c: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0011: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0016: nop
+ IL_0017: ldarg.0
+ IL_0018: stloc.1
+ IL_0019: ldloc.1
+ IL_001a: ldc.i4.4
+ IL_001b: bgt.s IL_004c
+
+ IL_001d: ldloc.1
+ IL_001e: ldc.i4 0xff676980
+ IL_0023: beq.s IL_006f
+
+ IL_0025: ldloc.1
+ IL_0026: ldc.i4.s -100
+ IL_0028: beq.s IL_0077
+
+ IL_002a: ldloc.1
+ IL_002b: ldc.i4.m1
+ IL_002c: sub
+ IL_002d: switch (
+ IL_007f,
+ IL_0087,
+ IL_008f,
+ IL_0097,
+ IL_00c7,
+ IL_009f)
+ IL_004a: br.s IL_00c7
+
+ IL_004c: ldloc.1
+ IL_004d: ldc.i4.s 100
+ IL_004f: beq.s IL_00a7
+
+ IL_0051: ldloc.1
+ IL_0052: ldc.i4 0x2710
+ IL_0057: sub
+ IL_0058: switch (
+ IL_00af,
+ IL_00b7)
+ IL_0065: ldloc.1
+ IL_0066: ldc.i4 0x7fffffff
+ IL_006b: beq.s IL_00bf
+
+ IL_006d: br.s IL_00c7
+
+ IL_006f: ldstr "-10 mln"
+ IL_0074: stloc.0
+ IL_0075: br.s IL_00cf
+
+ IL_0077: ldstr "-hundred"
+ IL_007c: stloc.0
+ IL_007d: br.s IL_00cf
+
+ IL_007f: ldstr "-1"
+ IL_0084: stloc.0
+ IL_0085: br.s IL_00cf
+
+ IL_0087: ldstr "0"
+ IL_008c: stloc.0
+ IL_008d: br.s IL_00cf
+
+ IL_008f: ldstr "1"
+ IL_0094: stloc.0
+ IL_0095: br.s IL_00cf
+
+ IL_0097: ldstr "2"
+ IL_009c: stloc.0
+ IL_009d: br.s IL_00cf
+
+ IL_009f: ldstr "4"
+ IL_00a4: stloc.0
+ IL_00a5: br.s IL_00cf
+
+ IL_00a7: ldstr "hundred"
+ IL_00ac: stloc.0
+ IL_00ad: br.s IL_00cf
+
+ IL_00af: ldstr "ten thousand"
+ IL_00b4: stloc.0
+ IL_00b5: br.s IL_00cf
+
+ IL_00b7: ldstr "ten thousand and one"
+ IL_00bc: stloc.0
+ IL_00bd: br.s IL_00cf
+
+ IL_00bf: ldstr "int.MaxValue"
+ IL_00c4: stloc.0
+ IL_00c5: br.s IL_00cf
+
+ IL_00c7: ldstr "something else"
+ IL_00cc: stloc.0
+ IL_00cd: br.s IL_00cf
+
+ IL_00cf: ldloc.0
+ IL_00d0: ret
+ } // end of method Switch::SparseIntegerSwitch
+
+ .method public hidebysig static string
+ SwitchOverNullableInt(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 74 (0x4a)
+ .maxstack 2
+ .locals init (string V_0,
+ int32 V_1)
+ IL_0000: nop
+ IL_0001: ldarga.s i
+ IL_0003: dup
+ IL_0004: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0009: stloc.1
+ IL_000a: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000f: brfalse.s IL_0020
+
+ IL_0011: ldloc.1
+ IL_0012: ldc.i4.0
+ IL_0013: beq.s IL_0028
+
+ IL_0015: ldloc.1
+ IL_0016: ldc.i4.5
+ IL_0017: beq.s IL_0030
+
+ IL_0019: ldloc.1
+ IL_001a: ldc.i4.s 10
+ IL_001c: beq.s IL_0038
+
+ IL_001e: br.s IL_0040
+
+ IL_0020: ldstr "null"
+ IL_0025: stloc.0
+ IL_0026: br.s IL_0048
+
+ IL_0028: ldstr "zero"
+ IL_002d: stloc.0
+ IL_002e: br.s IL_0048
+
+ IL_0030: ldstr "five"
+ IL_0035: stloc.0
+ IL_0036: br.s IL_0048
+
+ IL_0038: ldstr "ten"
+ IL_003d: stloc.0
+ IL_003e: br.s IL_0048
+
+ IL_0040: ldstr "large"
+ IL_0045: stloc.0
+ IL_0046: br.s IL_0048
+
+ IL_0048: ldloc.0
+ IL_0049: ret
+ } // end of method Switch::SwitchOverNullableInt
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNullCaseCombined(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 66 (0x42)
+ .maxstack 2
+ .locals init (string V_0,
+ int32 V_1)
+ IL_0000: nop
+ IL_0001: ldarga.s i
+ IL_0003: dup
+ IL_0004: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0009: stloc.1
+ IL_000a: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000f: brfalse.s IL_0020
+
+ IL_0011: ldloc.1
+ IL_0012: ldc.i4.0
+ IL_0013: beq.s IL_0020
+
+ IL_0015: ldloc.1
+ IL_0016: ldc.i4.5
+ IL_0017: beq.s IL_0028
+
+ IL_0019: ldloc.1
+ IL_001a: ldc.i4.s 10
+ IL_001c: beq.s IL_0030
+
+ IL_001e: br.s IL_0038
+
+ IL_0020: ldstr "zero"
+ IL_0025: stloc.0
+ IL_0026: br.s IL_0040
+
+ IL_0028: ldstr "five"
+ IL_002d: stloc.0
+ IL_002e: br.s IL_0040
+
+ IL_0030: ldstr "ten"
+ IL_0035: stloc.0
+ IL_0036: br.s IL_0040
+
+ IL_0038: ldstr "large"
+ IL_003d: stloc.0
+ IL_003e: br.s IL_0040
+
+ IL_0040: ldloc.0
+ IL_0041: ret
+ } // end of method Switch::SwitchOverNullableIntNullCaseCombined
+
+ .method public hidebysig static string
+ SwitchOverNullableIntShifted(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 112 (0x70)
+ .maxstack 2
+ .locals init (string V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: nop
+ IL_0001: ldarg.0
+ IL_0002: stloc.1
+ IL_0003: ldloca.s V_1
+ IL_0005: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000a: brtrue.s IL_0017
+
+ IL_000c: ldloca.s V_2
+ IL_000e: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0014: ldloc.2
+ IL_0015: br.s IL_0025
+
+ IL_0017: ldloca.s V_1
+ IL_0019: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001e: ldc.i4.5
+ IL_001f: add
+ IL_0020: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0025: nop
+ IL_0026: stloc.2
+ IL_0027: ldloca.s V_2
+ IL_0029: dup
+ IL_002a: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_002f: stloc.3
+ IL_0030: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0035: brfalse.s IL_0046
+
+ IL_0037: ldloc.3
+ IL_0038: ldc.i4.0
+ IL_0039: beq.s IL_004e
+
+ IL_003b: ldloc.3
+ IL_003c: ldc.i4.5
+ IL_003d: beq.s IL_0056
+
+ IL_003f: ldloc.3
+ IL_0040: ldc.i4.s 10
+ IL_0042: beq.s IL_005e
+
+ IL_0044: br.s IL_0066
+
+ IL_0046: ldstr "null"
+ IL_004b: stloc.0
+ IL_004c: br.s IL_006e
+
+ IL_004e: ldstr "zero"
+ IL_0053: stloc.0
+ IL_0054: br.s IL_006e
+
+ IL_0056: ldstr "five"
+ IL_005b: stloc.0
+ IL_005c: br.s IL_006e
+
+ IL_005e: ldstr "ten"
+ IL_0063: stloc.0
+ IL_0064: br.s IL_006e
+
+ IL_0066: ldstr "large"
+ IL_006b: stloc.0
+ IL_006c: br.s IL_006e
+
+ IL_006e: ldloc.0
+ IL_006f: ret
+ } // end of method Switch::SwitchOverNullableIntShifted
+
+ .method public hidebysig static string
+ SwitchOverNullableIntShiftedNullCaseCombined(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 104 (0x68)
+ .maxstack 2
+ .locals init (string V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: nop
+ IL_0001: ldarg.0
+ IL_0002: stloc.1
+ IL_0003: ldloca.s V_1
+ IL_0005: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000a: brtrue.s IL_0017
+
+ IL_000c: ldloca.s V_2
+ IL_000e: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0014: ldloc.2
+ IL_0015: br.s IL_0025
+
+ IL_0017: ldloca.s V_1
+ IL_0019: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001e: ldc.i4.5
+ IL_001f: add
+ IL_0020: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0025: nop
+ IL_0026: stloc.2
+ IL_0027: ldloca.s V_2
+ IL_0029: dup
+ IL_002a: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_002f: stloc.3
+ IL_0030: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0035: brfalse.s IL_0046
+
+ IL_0037: ldloc.3
+ IL_0038: ldc.i4.0
+ IL_0039: beq.s IL_0046
+
+ IL_003b: ldloc.3
+ IL_003c: ldc.i4.5
+ IL_003d: beq.s IL_004e
+
+ IL_003f: ldloc.3
+ IL_0040: ldc.i4.s 10
+ IL_0042: beq.s IL_0056
+
+ IL_0044: br.s IL_005e
+
+ IL_0046: ldstr "zero"
+ IL_004b: stloc.0
+ IL_004c: br.s IL_0066
+
+ IL_004e: ldstr "five"
+ IL_0053: stloc.0
+ IL_0054: br.s IL_0066
+
+ IL_0056: ldstr "ten"
+ IL_005b: stloc.0
+ IL_005c: br.s IL_0066
+
+ IL_005e: ldstr "large"
+ IL_0063: stloc.0
+ IL_0064: br.s IL_0066
+
+ IL_0066: ldloc.0
+ IL_0067: ret
+ } // end of method Switch::SwitchOverNullableIntShiftedNullCaseCombined
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNoNullCase(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 66 (0x42)
+ .maxstack 2
+ .locals init (string V_0,
+ int32 V_1)
+ IL_0000: nop
+ IL_0001: ldarga.s i
+ IL_0003: dup
+ IL_0004: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0009: stloc.1
+ IL_000a: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000f: brfalse.s IL_0038
+
+ IL_0011: ldloc.1
+ IL_0012: ldc.i4.0
+ IL_0013: beq.s IL_0020
+
+ IL_0015: ldloc.1
+ IL_0016: ldc.i4.5
+ IL_0017: beq.s IL_0028
+
+ IL_0019: ldloc.1
+ IL_001a: ldc.i4.s 10
+ IL_001c: beq.s IL_0030
+
+ IL_001e: br.s IL_0038
+
+ IL_0020: ldstr "zero"
+ IL_0025: stloc.0
+ IL_0026: br.s IL_0040
+
+ IL_0028: ldstr "five"
+ IL_002d: stloc.0
+ IL_002e: br.s IL_0040
+
+ IL_0030: ldstr "ten"
+ IL_0035: stloc.0
+ IL_0036: br.s IL_0040
+
+ IL_0038: ldstr "other"
+ IL_003d: stloc.0
+ IL_003e: br.s IL_0040
+
+ IL_0040: ldloc.0
+ IL_0041: ret
+ } // end of method Switch::SwitchOverNullableIntNoNullCase
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNoNullCaseShifted(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 104 (0x68)
+ .maxstack 2
+ .locals init (string V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: nop
+ IL_0001: ldarg.0
+ IL_0002: stloc.1
+ IL_0003: ldloca.s V_1
+ IL_0005: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000a: brtrue.s IL_0017
+
+ IL_000c: ldloca.s V_2
+ IL_000e: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0014: ldloc.2
+ IL_0015: br.s IL_0025
+
+ IL_0017: ldloca.s V_1
+ IL_0019: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001e: ldc.i4.5
+ IL_001f: add
+ IL_0020: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0025: nop
+ IL_0026: stloc.2
+ IL_0027: ldloca.s V_2
+ IL_0029: dup
+ IL_002a: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_002f: stloc.3
+ IL_0030: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0035: brfalse.s IL_005e
+
+ IL_0037: ldloc.3
+ IL_0038: ldc.i4.0
+ IL_0039: beq.s IL_0046
+
+ IL_003b: ldloc.3
+ IL_003c: ldc.i4.5
+ IL_003d: beq.s IL_004e
+
+ IL_003f: ldloc.3
+ IL_0040: ldc.i4.s 10
+ IL_0042: beq.s IL_0056
+
+ IL_0044: br.s IL_005e
+
+ IL_0046: ldstr "zero"
+ IL_004b: stloc.0
+ IL_004c: br.s IL_0066
+
+ IL_004e: ldstr "five"
+ IL_0053: stloc.0
+ IL_0054: br.s IL_0066
+
+ IL_0056: ldstr "ten"
+ IL_005b: stloc.0
+ IL_005c: br.s IL_0066
+
+ IL_005e: ldstr "other"
+ IL_0063: stloc.0
+ IL_0064: br.s IL_0066
+
+ IL_0066: ldloc.0
+ IL_0067: ret
+ } // end of method Switch::SwitchOverNullableIntNoNullCaseShifted
+
+ .method public hidebysig static void SwitchOverInt(int32 i) cil managed
+ {
+ // Code size 144 (0x90)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: nop
+ IL_0001: ldarg.0
+ IL_0002: stloc.0
+ IL_0003: ldloc.0
+ IL_0004: ldc.i4.s 10
+ IL_0006: bgt.s IL_0017
+
+ IL_0008: ldloc.0
+ IL_0009: ldc.i4.0
+ IL_000a: beq.s IL_0034
+
+ IL_000c: ldloc.0
+ IL_000d: ldc.i4.5
+ IL_000e: beq.s IL_0041
+
+ IL_0010: ldloc.0
+ IL_0011: ldc.i4.s 10
+ IL_0013: beq.s IL_004e
+
+ IL_0015: br.s IL_008f
+
+ IL_0017: ldloc.0
+ IL_0018: ldc.i4.s 20
+ IL_001a: bgt.s IL_0028
+
+ IL_001c: ldloc.0
+ IL_001d: ldc.i4.s 15
+ IL_001f: beq.s IL_005b
+
+ IL_0021: ldloc.0
+ IL_0022: ldc.i4.s 20
+ IL_0024: beq.s IL_0068
+
+ IL_0026: br.s IL_008f
+
+ IL_0028: ldloc.0
+ IL_0029: ldc.i4.s 25
+ IL_002b: beq.s IL_0075
+
+ IL_002d: ldloc.0
+ IL_002e: ldc.i4.s 30
+ IL_0030: beq.s IL_0082
+
+ IL_0032: br.s IL_008f
+
+ IL_0034: ldstr "zero"
+ IL_0039: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003e: nop
+ IL_003f: br.s IL_008f
+
+ IL_0041: ldstr "five"
+ IL_0046: call void [mscorlib]System.Console::WriteLine(string)
+ IL_004b: nop
+ IL_004c: br.s IL_008f
+
+ IL_004e: ldstr "ten"
+ IL_0053: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0058: nop
+ IL_0059: br.s IL_008f
+
+ IL_005b: ldstr "fifteen"
+ IL_0060: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0065: nop
+ IL_0066: br.s IL_008f
+
+ IL_0068: ldstr "twenty"
+ IL_006d: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0072: nop
+ IL_0073: br.s IL_008f
+
+ IL_0075: ldstr "twenty-five"
+ IL_007a: call void [mscorlib]System.Console::WriteLine(string)
+ IL_007f: nop
+ IL_0080: br.s IL_008f
+
+ IL_0082: ldstr "thirty"
+ IL_0087: call void [mscorlib]System.Console::WriteLine(string)
+ IL_008c: nop
+ IL_008d: br.s IL_008f
+
+ IL_008f: ret
+ } // end of method Switch::SwitchOverInt
+
+ .method public hidebysig static string
+ ShortSwitchOverString(string text) cil managed
+ {
+ // Code size 98 (0x62)
+ .maxstack 2
+ .locals init (string V_0,
+ string V_1)
+ IL_0000: nop
+ IL_0001: ldstr "ShortSwitchOverString: "
+ 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.1
+ IL_0014: ldloc.1
+ IL_0015: brfalse.s IL_0058
+
+ IL_0017: ldloc.1
+ IL_0018: ldstr "First case"
+ IL_001d: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0022: brtrue.s IL_0040
+
+ IL_0024: ldloc.1
+ IL_0025: ldstr "Second case"
+ IL_002a: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_002f: brtrue.s IL_0048
+
+ IL_0031: ldloc.1
+ IL_0032: ldstr "Third case"
+ IL_0037: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_003c: brtrue.s IL_0050
+
+ IL_003e: br.s IL_0058
+
+ IL_0040: ldstr "Text1"
+ IL_0045: stloc.0
+ IL_0046: br.s IL_0060
+
+ IL_0048: ldstr "Text2"
+ IL_004d: stloc.0
+ IL_004e: br.s IL_0060
+
+ IL_0050: ldstr "Text3"
+ IL_0055: stloc.0
+ IL_0056: br.s IL_0060
+
+ IL_0058: ldstr "Default"
+ IL_005d: stloc.0
+ IL_005e: br.s IL_0060
+
+ IL_0060: ldloc.0
+ IL_0061: ret
+ } // end of method Switch::ShortSwitchOverString
+
+ .method public hidebysig static string
+ ShortSwitchOverStringWithNullCase(string text) cil managed
+ {
+ // Code size 85 (0x55)
+ .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.1
+ IL_0014: ldloc.1
+ IL_0015: brfalse.s IL_0043
+
+ IL_0017: ldloc.1
+ IL_0018: ldstr "First case"
+ IL_001d: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0022: brtrue.s IL_0033
+
+ IL_0024: ldloc.1
+ IL_0025: ldstr "Second case"
+ IL_002a: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_002f: brtrue.s IL_003b
+
+ IL_0031: br.s IL_004b
+
+ IL_0033: ldstr "Text1"
+ IL_0038: stloc.0
+ IL_0039: br.s IL_0053
+
+ IL_003b: ldstr "Text2"
+ IL_0040: stloc.0
+ IL_0041: br.s IL_0053
+
+ IL_0043: ldstr "null"
+ IL_0048: stloc.0
+ IL_0049: br.s IL_0053
+
+ IL_004b: ldstr "Default"
+ IL_0050: stloc.0
+ IL_0051: br.s IL_0053
+
+ IL_0053: ldloc.0
+ IL_0054: ret
+ } // end of method Switch::ShortSwitchOverStringWithNullCase
+
+ .method public hidebysig static string
+ SwitchOverString1(string text) cil managed
+ {
+ // Code size 247 (0xf7)
+ .maxstack 4
+ .locals init (string V_0,
+ string V_1,
+ int32 V_2)
+ IL_0000: nop
+ IL_0001: ldstr "SwitchOverString1: "
+ 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.1
+ IL_0014: ldloc.1
+ IL_0015: brfalse IL_00e9
+
+ IL_001a: volatile.
+ IL_001c: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x600000b-1'
+ IL_0021: brtrue.s IL_0084
+
+ IL_0023: ldc.i4.7
+ IL_0024: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2::.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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ IL_0041: dup
+ IL_0042: ldstr "2nd case"
+ IL_0047: ldc.i4.2
+ IL_0048: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_004d: dup
+ IL_004e: ldstr "Third case"
+ IL_0053: ldc.i4.3
+ IL_0054: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0059: dup
+ IL_005a: ldstr "Fourth case"
+ IL_005f: ldc.i4.4
+ IL_0060: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0065: dup
+ IL_0066: ldstr "Fifth case"
+ IL_006b: ldc.i4.5
+ IL_006c: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0071: dup
+ IL_0072: ldstr "Sixth case"
+ IL_0077: ldc.i4.6
+ IL_0078: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_007d: volatile.
+ IL_007f: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x600000b-1'
+ IL_0084: volatile.
+ IL_0086: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x600000b-1'
+ IL_008b: ldloc.1
+ IL_008c: ldloca.s V_2
+ IL_008e: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2::TryGetValue(!0,
+ !1&)
+ IL_0093: brfalse.s IL_00ed
+
+ IL_0095: ldloc.2
+ IL_0096: switch (
+ IL_00b9,
+ IL_00c1,
+ IL_00c1,
+ IL_00c9,
+ IL_00d1,
+ IL_00d9,
+ IL_00e1)
+ IL_00b7: br.s IL_00ed
+
+ IL_00b9: ldstr "Text1"
+ IL_00be: stloc.0
+ IL_00bf: br.s IL_00f5
+
+ IL_00c1: ldstr "Text2"
+ IL_00c6: stloc.0
+ IL_00c7: br.s IL_00f5
+
+ IL_00c9: ldstr "Text3"
+ IL_00ce: stloc.0
+ IL_00cf: br.s IL_00f5
+
+ IL_00d1: ldstr "Text4"
+ IL_00d6: stloc.0
+ IL_00d7: br.s IL_00f5
+
+ IL_00d9: ldstr "Text5"
+ IL_00de: stloc.0
+ IL_00df: br.s IL_00f5
+
+ IL_00e1: ldstr "Text6"
+ IL_00e6: stloc.0
+ IL_00e7: br.s IL_00f5
+
+ IL_00e9: ldnull
+ IL_00ea: stloc.0
+ IL_00eb: br.s IL_00f5
+
+ IL_00ed: ldstr "Default"
+ IL_00f2: stloc.0
+ IL_00f3: br.s IL_00f5
+
+ IL_00f5: ldloc.0
+ IL_00f6: ret
+ } // end of method Switch::SwitchOverString1
+
+ .method public hidebysig static string
+ SwitchOverString2() cil managed
+ {
+ // Code size 354 (0x162)
+ .maxstack 4
+ .locals init (string V_0,
+ string V_1,
+ int32 V_2)
+ IL_0000: nop
+ IL_0001: ldstr "SwitchOverString2:"
+ IL_0006: call void [mscorlib]System.Console::WriteLine(string)
+ IL_000b: nop
+ IL_000c: call string [mscorlib]System.Environment::get_UserName()
+ IL_0011: stloc.1
+ IL_0012: ldloc.1
+ IL_0013: brfalse IL_0158
+
+ IL_0018: volatile.
+ IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x600000c-1'
+ IL_001f: brtrue IL_00b8
+
+ IL_0024: ldc.i4.s 11
+ IL_0026: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2::.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::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::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::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::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::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::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::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::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::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::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::Add(!0,
+ !1)
+ IL_00b1: volatile.
+ IL_00b3: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x600000c-1'
+ IL_00b8: volatile.
+ IL_00ba: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x600000c-1'
+ IL_00bf: ldloc.1
+ IL_00c0: ldloca.s V_2
+ IL_00c2: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2::TryGetValue(!0,
+ !1&)
+ IL_00c7: brfalse IL_0158
+
+ IL_00cc: ldloc.2
+ IL_00cd: switch (
+ IL_0100,
+ IL_0108,
+ IL_0110,
+ IL_0118,
+ IL_0120,
+ IL_0128,
+ IL_0130,
+ IL_0138,
+ IL_0140,
+ IL_0148,
+ IL_0150)
+ IL_00fe: br.s IL_0158
+
+ IL_0100: ldstr "Text1"
+ IL_0105: stloc.0
+ IL_0106: br.s IL_0160
+
+ IL_0108: ldstr "Text2"
+ IL_010d: stloc.0
+ IL_010e: br.s IL_0160
+
+ IL_0110: ldstr "Text3"
+ IL_0115: stloc.0
+ IL_0116: br.s IL_0160
+
+ IL_0118: ldstr "Text4"
+ IL_011d: stloc.0
+ IL_011e: br.s IL_0160
+
+ IL_0120: ldstr "Text5"
+ IL_0125: stloc.0
+ IL_0126: br.s IL_0160
+
+ IL_0128: ldstr "Text6"
+ IL_012d: stloc.0
+ IL_012e: br.s IL_0160
+
+ IL_0130: ldstr "Text7"
+ IL_0135: stloc.0
+ IL_0136: br.s IL_0160
+
+ IL_0138: ldstr "Text8"
+ IL_013d: stloc.0
+ IL_013e: br.s IL_0160
+
+ IL_0140: ldstr "Text9"
+ IL_0145: stloc.0
+ IL_0146: br.s IL_0160
+
+ IL_0148: ldstr "Text10"
+ IL_014d: stloc.0
+ IL_014e: br.s IL_0160
+
+ IL_0150: ldstr "Text11"
+ IL_0155: stloc.0
+ IL_0156: br.s IL_0160
+
+ IL_0158: ldstr "Default"
+ IL_015d: stloc.0
+ IL_015e: br.s IL_0160
+
+ IL_0160: ldloc.0
+ IL_0161: ret
+ } // end of method Switch::SwitchOverString2
+
+ .method public hidebysig static string
+ SwitchOverBool(bool b) cil managed
+ {
+ // Code size 64 (0x40)
+ .maxstack 2
+ .locals init (string V_0,
+ bool V_1)
+ IL_0000: nop
+ IL_0001: ldstr "SwitchOverBool: "
+ IL_0006: ldarga.s b
+ IL_0008: call instance string [mscorlib]System.Boolean::ToString()
+ IL_000d: call string [mscorlib]System.String::Concat(string,
+ string)
+ IL_0012: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0017: nop
+ IL_0018: ldarg.0
+ IL_0019: stloc.1
+ IL_001a: ldloc.1
+ IL_001b: switch (
+ IL_0032,
+ IL_002a)
+ IL_0028: br.s IL_003a
+
+ IL_002a: ldsfld string [mscorlib]System.Boolean::TrueString
+ IL_002f: stloc.0
+ IL_0030: br.s IL_003e
+
+ IL_0032: ldsfld string [mscorlib]System.Boolean::FalseString
+ IL_0037: stloc.0
+ IL_0038: br.s IL_003e
+
+ IL_003a: ldnull
+ IL_003b: stloc.0
+ IL_003c: br.s IL_003e
+
+ IL_003e: ldloc.0
+ IL_003f: ret
+ } // end of method Switch::SwitchOverBool
+
+ .method public hidebysig static void SwitchInLoop(int32 i) cil managed
+ {
+ // Code size 128 (0x80)
+ .maxstack 2
+ .locals init (int32 V_0,
+ bool V_1)
+ IL_0000: nop
+ IL_0001: ldstr "SwitchInLoop: "
+ IL_0006: ldarg.0
+ IL_0007: box [mscorlib]System.Int32
+ IL_000c: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0011: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0016: nop
+ IL_0017: br.s IL_007b
+
+ IL_0019: nop
+ IL_001a: ldarg.0
+ IL_001b: stloc.0
+ IL_001c: ldloc.0
+ IL_001d: ldc.i4.1
+ IL_001e: sub
+ IL_001f: switch (
+ IL_0036,
+ IL_0043,
+ IL_005d,
+ IL_0050)
+ IL_0034: br.s IL_005d
+
+ IL_0036: ldstr "one"
+ IL_003b: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0040: nop
+ IL_0041: br.s IL_0075
+
+ IL_0043: ldstr "two"
+ IL_0048: call void [mscorlib]System.Console::WriteLine(string)
+ IL_004d: nop
+ IL_004e: br.s IL_0075
+
+ IL_0050: ldstr "four"
+ IL_0055: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005a: nop
+ IL_005b: br.s IL_007f
+
+ IL_005d: ldstr "default"
+ IL_0062: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0067: nop
+ IL_0068: ldstr "more code"
+ IL_006d: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0072: nop
+ IL_0073: br.s IL_007f
+
+ IL_0075: ldarg.0
+ IL_0076: ldc.i4.1
+ IL_0077: add
+ IL_0078: starg.s i
+ IL_007a: nop
+ IL_007b: ldc.i4.1
+ IL_007c: stloc.1
+ IL_007d: br.s IL_0019
+
+ IL_007f: ret
+ } // end of method Switch::SwitchInLoop
+
+ .method public hidebysig static void SwitchWithGoto(int32 i) cil managed
+ {
+ // Code size 128 (0x80)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: nop
+ IL_0001: ldstr "SwitchWithGoto: "
+ IL_0006: ldarg.0
+ IL_0007: box [mscorlib]System.Int32
+ IL_000c: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0011: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0016: nop
+ IL_0017: ldarg.0
+ IL_0018: stloc.0
+ IL_0019: ldloc.0
+ IL_001a: ldc.i4.1
+ IL_001b: sub
+ IL_001c: switch (
+ IL_0033,
+ IL_0040,
+ IL_004d,
+ IL_005a)
+ IL_0031: br.s IL_0067
+
+ IL_0033: ldstr "one"
+ IL_0038: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003d: nop
+ IL_003e: br.s IL_0067
+
+ IL_0040: ldstr "two"
+ IL_0045: call void [mscorlib]System.Console::WriteLine(string)
+ IL_004a: nop
+ IL_004b: br.s IL_004d
+
+ IL_004d: ldstr "three"
+ IL_0052: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0057: nop
+ IL_0058: br.s IL_0074
+
+ IL_005a: ldstr "four"
+ IL_005f: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0064: nop
+ IL_0065: br.s IL_007f
+
+ IL_0067: ldstr "default"
+ IL_006c: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0071: nop
+ IL_0072: br.s IL_0074
+
+ IL_0074: ldstr "End of method"
+ IL_0079: call void [mscorlib]System.Console::WriteLine(string)
+ IL_007e: nop
+ IL_007f: ret
+ } // end of method Switch::SwitchWithGoto
+
+ .method private hidebysig static class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty[]
+ GetProperties() cil managed
+ {
+ // Code size 12 (0xc)
+ .maxstack 1
+ .locals init (class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty[] V_0)
+ IL_0000: nop
+ IL_0001: ldc.i4.0
+ IL_0002: newarr ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty
+ IL_0007: stloc.0
+ IL_0008: br.s IL_000a
+
+ IL_000a: ldloc.0
+ IL_000b: ret
+ } // end of method Switch::GetProperties
+
+ .method public hidebysig static void SwitchOnStringInForLoop() cil managed
+ {
+ // Code size 321 (0x141)
+ .maxstack 4
+ .locals init (class [mscorlib]System.Collections.Generic.List`1 V_0,
+ class [mscorlib]System.Collections.Generic.List`1 V_1,
+ class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty[] V_2,
+ int32 V_3,
+ class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty V_4,
+ string V_5,
+ int32 V_6,
+ bool V_7)
+ IL_0000: nop
+ IL_0001: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor()
+ IL_0006: stloc.0
+ IL_0007: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor()
+ IL_000c: stloc.1
+ IL_000d: call class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch::GetProperties()
+ IL_0012: stloc.2
+ IL_0013: ldc.i4.0
+ IL_0014: stloc.3
+ IL_0015: br IL_0131
+
+ IL_001a: nop
+ IL_001b: ldloc.2
+ IL_001c: ldloc.3
+ IL_001d: ldelem.ref
+ IL_001e: stloc.s V_4
+ IL_0020: ldloc.s V_4
+ IL_0022: ldfld class [mscorlib]System.Reflection.PropertyInfo ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::Property
+ 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: brfalse IL_0121
+
+ IL_0035: volatile.
+ IL_0037: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x6000011-1'
+ IL_003c: brtrue.s IL_0093
+
+ IL_003e: ldc.i4.6
+ IL_003f: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2::.ctor(int32)
+ IL_0044: dup
+ IL_0045: ldstr "Name1"
+ IL_004a: ldc.i4.0
+ IL_004b: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0050: dup
+ IL_0051: ldstr "Name2"
+ IL_0056: ldc.i4.1
+ IL_0057: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_005c: dup
+ IL_005d: ldstr "Name3"
+ IL_0062: ldc.i4.2
+ IL_0063: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0068: dup
+ IL_0069: ldstr "Name4"
+ IL_006e: ldc.i4.3
+ IL_006f: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0074: dup
+ IL_0075: ldstr "Name5"
+ IL_007a: ldc.i4.4
+ IL_007b: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0080: dup
+ IL_0081: ldstr "Name6"
+ IL_0086: ldc.i4.5
+ IL_0087: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_008c: volatile.
+ IL_008e: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x6000011-1'
+ IL_0093: volatile.
+ IL_0095: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'::'$$method0x6000011-1'
+ IL_009a: ldloc.s V_5
+ IL_009c: ldloca.s V_6
+ IL_009e: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2::TryGetValue(!0,
+ !1&)
+ IL_00a3: brfalse.s IL_0121
+
+ IL_00a5: ldloc.s V_6
+ IL_00a7: switch (
+ IL_00c6,
+ IL_00da,
+ IL_00ee,
+ IL_0102,
+ IL_0116,
+ IL_0116)
+ IL_00c4: br.s IL_0121
+
+ IL_00c6: ldloc.s V_4
+ IL_00c8: ldc.i4.1
+ IL_00c9: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
+ IL_00ce: nop
+ IL_00cf: ldloc.0
+ IL_00d0: ldloc.s V_4
+ IL_00d2: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0)
+ IL_00d7: nop
+ IL_00d8: br.s IL_012c
+
+ IL_00da: ldloc.s V_4
+ IL_00dc: ldc.i4.2
+ IL_00dd: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
+ IL_00e2: nop
+ IL_00e3: ldloc.0
+ IL_00e4: ldloc.s V_4
+ IL_00e6: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0)
+ IL_00eb: nop
+ IL_00ec: br.s IL_012c
+
+ IL_00ee: ldloc.s V_4
+ IL_00f0: ldc.i4.3
+ IL_00f1: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
+ IL_00f6: nop
+ IL_00f7: ldloc.0
+ IL_00f8: ldloc.s V_4
+ IL_00fa: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0)
+ IL_00ff: nop
+ IL_0100: br.s IL_012c
+
+ IL_0102: ldloc.s V_4
+ IL_0104: ldc.i4.4
+ IL_0105: callvirt instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
+ IL_010a: nop
+ IL_010b: ldloc.0
+ IL_010c: ldloc.s V_4
+ IL_010e: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0)
+ IL_0113: nop
+ IL_0114: br.s IL_012c
+
+ IL_0116: ldloc.0
+ IL_0117: ldloc.s V_4
+ IL_0119: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0)
+ IL_011e: nop
+ IL_011f: br.s IL_012c
+
+ IL_0121: ldloc.1
+ IL_0122: ldloc.s V_4
+ IL_0124: callvirt instance void class [mscorlib]System.Collections.Generic.List`1::Add(!0)
+ IL_0129: nop
+ IL_012a: br.s IL_012c
+
+ IL_012c: nop
+ IL_012d: ldloc.3
+ IL_012e: ldc.i4.1
+ IL_012f: add
+ IL_0130: stloc.3
+ IL_0131: ldloc.3
+ IL_0132: ldloc.2
+ IL_0133: ldlen
+ IL_0134: conv.i4
+ IL_0135: clt
+ IL_0137: stloc.s V_7
+ IL_0139: ldloc.s V_7
+ IL_013b: brtrue IL_001a
+
+ IL_0140: ret
+ } // end of method Switch::SwitchOnStringInForLoop
+
+ .method public hidebysig static void SwitchWithComplexCondition(string[] args) cil managed
+ {
+ // Code size 139 (0x8b)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: nop
+ IL_0001: ldarg.0
+ IL_0002: ldlen
+ IL_0003: conv.i4
+ IL_0004: brfalse.s IL_000b
+
+ IL_0006: ldarg.0
+ IL_0007: ldc.i4.0
+ IL_0008: ldelem.ref
+ IL_0009: br.s IL_0010
+
+ IL_000b: ldstr "dummy"
+ IL_0010: nop
+ IL_0011: stloc.0
+ IL_0012: ldloc.0
+ IL_0013: brfalse.s IL_007f
+
+ IL_0015: ldloc.0
+ IL_0016: ldstr "a"
+ IL_001b: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0020: brtrue.s IL_004b
+
+ IL_0022: ldloc.0
+ IL_0023: ldstr "b"
+ IL_0028: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_002d: brtrue.s IL_0058
+
+ IL_002f: ldloc.0
+ IL_0030: ldstr "c"
+ IL_0035: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_003a: brtrue.s IL_0065
+
+ IL_003c: ldloc.0
+ IL_003d: ldstr "d"
+ IL_0042: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0047: brtrue.s IL_0072
+
+ IL_0049: br.s IL_007f
+
+ IL_004b: ldstr "a"
+ IL_0050: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0055: nop
+ IL_0056: br.s IL_007f
+
+ IL_0058: ldstr "b"
+ IL_005d: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0062: nop
+ IL_0063: br.s IL_007f
+
+ IL_0065: ldstr "c"
+ IL_006a: call void [mscorlib]System.Console::WriteLine(string)
+ IL_006f: nop
+ IL_0070: br.s IL_007f
+
+ IL_0072: ldstr "d"
+ IL_0077: call void [mscorlib]System.Console::WriteLine(string)
+ IL_007c: nop
+ IL_007d: br.s IL_007f
+
+ IL_007f: ldstr "end"
+ IL_0084: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0089: nop
+ IL_008a: ret
+ } // end of method Switch::SwitchWithComplexCondition
+
+ .method public hidebysig static void SwitchWithArray(string[] args) cil managed
+ {
+ // Code size 126 (0x7e)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: nop
+ IL_0001: ldarg.0
+ IL_0002: ldc.i4.0
+ IL_0003: ldelem.ref
+ IL_0004: stloc.0
+ IL_0005: ldloc.0
+ IL_0006: brfalse.s IL_0072
+
+ IL_0008: ldloc.0
+ IL_0009: ldstr "a"
+ IL_000e: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0013: brtrue.s IL_003e
+
+ IL_0015: ldloc.0
+ IL_0016: ldstr "b"
+ IL_001b: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0020: brtrue.s IL_004b
+
+ IL_0022: ldloc.0
+ IL_0023: ldstr "c"
+ IL_0028: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_002d: brtrue.s IL_0058
+
+ IL_002f: ldloc.0
+ IL_0030: ldstr "d"
+ IL_0035: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_003a: brtrue.s IL_0065
+
+ IL_003c: br.s IL_0072
+
+ IL_003e: ldstr "a"
+ IL_0043: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0048: nop
+ IL_0049: br.s IL_0072
+
+ IL_004b: ldstr "b"
+ IL_0050: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0055: nop
+ IL_0056: br.s IL_0072
+
+ IL_0058: ldstr "c"
+ IL_005d: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0062: nop
+ IL_0063: br.s IL_0072
+
+ IL_0065: ldstr "d"
+ IL_006a: call void [mscorlib]System.Console::WriteLine(string)
+ IL_006f: nop
+ IL_0070: br.s IL_0072
+
+ IL_0072: ldstr "end"
+ IL_0077: call void [mscorlib]System.Console::WriteLine(string)
+ IL_007c: nop
+ IL_007d: ret
+ } // end of method Switch::SwitchWithArray
+
+} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
+
+.class private auto ansi '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'
+ 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 '$$method0x600000b-1'
+ .field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2 '$$method0x600000c-1'
+ .field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2 '$$method0x6000011-1'
+} // end of class '{5E65DF13-3C5E-44CA-97E7-5B58ACBAF9BF}'
+
+
+// =============================================================
+
+// *********** DISASSEMBLY COMPLETE ***********************
+// Warnung: Win32-Ressourcendatei "../../../TestCases/Pretty\Switch.res" wurde erstellt.
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.il
new file mode 100644
index 000000000..44acd173c
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.il
@@ -0,0 +1,1306 @@
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
+// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
+
+
+
+// Metadata version: v4.0.30319
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly jfao3dmb
+{
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
+ .permissionset reqmin
+ = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module jfao3dmb.dll
+// MVID: {96F356C7-71A4-48B4-BE55-B48554E94654}
+.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: 0x01900000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
+ extends [mscorlib]System.Object
+{
+ .class auto ansi nested public beforefieldinit SetProperty
+ extends [mscorlib]System.Object
+ {
+ .field public initonly class [mscorlib]System.Reflection.PropertyInfo Property
+ .field private int32 'k__BackingField'
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .method public hidebysig specialname
+ instance int32 get_Set() cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::'k__BackingField'
+ IL_0006: ret
+ } // end of method SetProperty::get_Set
+
+ .method public hidebysig specialname
+ instance void set_Set(int32 'value') cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 8 (0x8)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::'k__BackingField'
+ IL_0007: ret
+ } // end of method SetProperty::set_Set
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(class [mscorlib]System.Reflection.PropertyInfo 'property') cil managed
+ {
+ // Code size 14 (0xe)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [mscorlib]System.Reflection.PropertyInfo ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::Property
+ IL_000d: ret
+ } // end of method SetProperty::.ctor
+
+ .property instance int32 Set()
+ {
+ .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::get_Set()
+ .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
+ } // end of property SetProperty::Set
+ } // end of class SetProperty
+
+ .method public hidebysig static string
+ SparseIntegerSwitch(int32 i) cil managed
+ {
+ // Code size 181 (0xb5)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: ldstr "SparseIntegerSwitch: "
+ IL_0005: ldarg.0
+ IL_0006: box [mscorlib]System.Int32
+ IL_000b: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0010: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0015: ldarg.0
+ IL_0016: stloc.0
+ IL_0017: ldloc.0
+ IL_0018: ldc.i4.4
+ IL_0019: bgt.s IL_004a
+
+ IL_001b: ldloc.0
+ IL_001c: ldc.i4 0xff676980
+ IL_0021: beq.s IL_006d
+
+ IL_0023: ldloc.0
+ IL_0024: ldc.i4.s -100
+ IL_0026: beq.s IL_0073
+
+ IL_0028: ldloc.0
+ IL_0029: ldc.i4.m1
+ IL_002a: sub
+ IL_002b: switch (
+ IL_0079,
+ IL_007f,
+ IL_0085,
+ IL_008b,
+ IL_00af,
+ IL_0091)
+ IL_0048: br.s IL_00af
+
+ IL_004a: ldloc.0
+ IL_004b: ldc.i4.s 100
+ IL_004d: beq.s IL_0097
+
+ IL_004f: ldloc.0
+ IL_0050: ldc.i4 0x2710
+ IL_0055: sub
+ IL_0056: switch (
+ IL_009d,
+ IL_00a3)
+ IL_0063: ldloc.0
+ IL_0064: ldc.i4 0x7fffffff
+ IL_0069: beq.s IL_00a9
+
+ IL_006b: br.s IL_00af
+
+ IL_006d: ldstr "-10 mln"
+ IL_0072: ret
+
+ IL_0073: ldstr "-hundred"
+ IL_0078: ret
+
+ IL_0079: ldstr "-1"
+ IL_007e: ret
+
+ IL_007f: ldstr "0"
+ IL_0084: ret
+
+ IL_0085: ldstr "1"
+ IL_008a: ret
+
+ IL_008b: ldstr "2"
+ IL_0090: ret
+
+ IL_0091: ldstr "4"
+ IL_0096: ret
+
+ IL_0097: ldstr "hundred"
+ IL_009c: ret
+
+ IL_009d: ldstr "ten thousand"
+ IL_00a2: ret
+
+ IL_00a3: ldstr "ten thousand and one"
+ IL_00a8: ret
+
+ IL_00a9: ldstr "int.MaxValue"
+ IL_00ae: ret
+
+ IL_00af: ldstr "something else"
+ IL_00b4: ret
+ } // end of method Switch::SparseIntegerSwitch
+
+ .method public hidebysig static string
+ SwitchOverNullableInt(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 61 (0x3d)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: ldarga.s i
+ IL_0002: dup
+ IL_0003: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0008: stloc.0
+ IL_0009: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000e: brfalse.s IL_001f
+
+ IL_0010: ldloc.0
+ IL_0011: ldc.i4.0
+ IL_0012: beq.s IL_0025
+
+ IL_0014: ldloc.0
+ IL_0015: ldc.i4.5
+ IL_0016: beq.s IL_002b
+
+ IL_0018: ldloc.0
+ IL_0019: ldc.i4.s 10
+ IL_001b: beq.s IL_0031
+
+ IL_001d: br.s IL_0037
+
+ IL_001f: ldstr "null"
+ IL_0024: ret
+
+ IL_0025: ldstr "zero"
+ IL_002a: ret
+
+ IL_002b: ldstr "five"
+ IL_0030: ret
+
+ IL_0031: ldstr "ten"
+ IL_0036: ret
+
+ IL_0037: ldstr "large"
+ IL_003c: ret
+ } // end of method Switch::SwitchOverNullableInt
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNullCaseCombined(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 55 (0x37)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: ldarga.s i
+ IL_0002: dup
+ IL_0003: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0008: stloc.0
+ IL_0009: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000e: brfalse.s IL_001f
+
+ IL_0010: ldloc.0
+ IL_0011: ldc.i4.0
+ IL_0012: beq.s IL_001f
+
+ IL_0014: ldloc.0
+ IL_0015: ldc.i4.5
+ IL_0016: beq.s IL_0025
+
+ IL_0018: ldloc.0
+ IL_0019: ldc.i4.s 10
+ IL_001b: beq.s IL_002b
+
+ IL_001d: br.s IL_0031
+
+ IL_001f: ldstr "zero"
+ IL_0024: ret
+
+ IL_0025: ldstr "five"
+ IL_002a: ret
+
+ IL_002b: ldstr "ten"
+ IL_0030: ret
+
+ IL_0031: ldstr "large"
+ IL_0036: ret
+ } // end of method Switch::SwitchOverNullableIntNullCaseCombined
+
+ .method public hidebysig static string
+ SwitchOverNullableIntShifted(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 98 (0x62)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: ldarg.0
+ IL_0001: stloc.0
+ IL_0002: ldloca.s V_0
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brtrue.s IL_0016
+
+ IL_000b: ldloca.s V_1
+ IL_000d: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0013: ldloc.1
+ IL_0014: br.s IL_0024
+
+ IL_0016: ldloca.s V_0
+ IL_0018: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001d: ldc.i4.5
+ IL_001e: add
+ IL_001f: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0024: stloc.2
+ IL_0025: ldloca.s V_2
+ IL_0027: dup
+ IL_0028: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_002d: stloc.3
+ IL_002e: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0033: brfalse.s IL_0044
+
+ IL_0035: ldloc.3
+ IL_0036: ldc.i4.0
+ IL_0037: beq.s IL_004a
+
+ IL_0039: ldloc.3
+ IL_003a: ldc.i4.5
+ IL_003b: beq.s IL_0050
+
+ IL_003d: ldloc.3
+ IL_003e: ldc.i4.s 10
+ IL_0040: beq.s IL_0056
+
+ IL_0042: br.s IL_005c
+
+ IL_0044: ldstr "null"
+ IL_0049: ret
+
+ IL_004a: ldstr "zero"
+ IL_004f: ret
+
+ IL_0050: ldstr "five"
+ IL_0055: ret
+
+ IL_0056: ldstr "ten"
+ IL_005b: ret
+
+ IL_005c: ldstr "large"
+ IL_0061: ret
+ } // end of method Switch::SwitchOverNullableIntShifted
+
+ .method public hidebysig static string
+ SwitchOverNullableIntShiftedNullCaseCombined(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 92 (0x5c)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: ldarg.0
+ IL_0001: stloc.0
+ IL_0002: ldloca.s V_0
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brtrue.s IL_0016
+
+ IL_000b: ldloca.s V_1
+ IL_000d: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0013: ldloc.1
+ IL_0014: br.s IL_0024
+
+ IL_0016: ldloca.s V_0
+ IL_0018: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001d: ldc.i4.5
+ IL_001e: add
+ IL_001f: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0024: stloc.2
+ IL_0025: ldloca.s V_2
+ IL_0027: dup
+ IL_0028: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_002d: stloc.3
+ IL_002e: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0033: brfalse.s IL_0044
+
+ IL_0035: ldloc.3
+ IL_0036: ldc.i4.0
+ IL_0037: beq.s IL_0044
+
+ IL_0039: ldloc.3
+ IL_003a: ldc.i4.5
+ IL_003b: beq.s IL_004a
+
+ IL_003d: ldloc.3
+ IL_003e: ldc.i4.s 10
+ IL_0040: beq.s IL_0050
+
+ IL_0042: br.s IL_0056
+
+ IL_0044: ldstr "zero"
+ IL_0049: ret
+
+ IL_004a: ldstr "five"
+ IL_004f: ret
+
+ IL_0050: ldstr "ten"
+ IL_0055: ret
+
+ IL_0056: ldstr "large"
+ IL_005b: ret
+ } // end of method Switch::SwitchOverNullableIntShiftedNullCaseCombined
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNoNullCase(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 55 (0x37)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: ldarga.s i
+ IL_0002: dup
+ IL_0003: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0008: stloc.0
+ IL_0009: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_000e: brfalse.s IL_0031
+
+ IL_0010: ldloc.0
+ IL_0011: ldc.i4.0
+ IL_0012: beq.s IL_001f
+
+ IL_0014: ldloc.0
+ IL_0015: ldc.i4.5
+ IL_0016: beq.s IL_0025
+
+ IL_0018: ldloc.0
+ IL_0019: ldc.i4.s 10
+ IL_001b: beq.s IL_002b
+
+ IL_001d: br.s IL_0031
+
+ IL_001f: ldstr "zero"
+ IL_0024: ret
+
+ IL_0025: ldstr "five"
+ IL_002a: ret
+
+ IL_002b: ldstr "ten"
+ IL_0030: ret
+
+ IL_0031: ldstr "other"
+ IL_0036: ret
+ } // end of method Switch::SwitchOverNullableIntNoNullCase
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNoNullCaseShifted(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 92 (0x5c)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: ldarg.0
+ IL_0001: stloc.0
+ IL_0002: ldloca.s V_0
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brtrue.s IL_0016
+
+ IL_000b: ldloca.s V_1
+ IL_000d: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0013: ldloc.1
+ IL_0014: br.s IL_0024
+
+ IL_0016: ldloca.s V_0
+ IL_0018: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001d: ldc.i4.5
+ IL_001e: add
+ IL_001f: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0024: stloc.2
+ IL_0025: ldloca.s V_2
+ IL_0027: dup
+ IL_0028: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_002d: stloc.3
+ IL_002e: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0033: brfalse.s IL_0056
+
+ IL_0035: ldloc.3
+ IL_0036: ldc.i4.0
+ IL_0037: beq.s IL_0044
+
+ IL_0039: ldloc.3
+ IL_003a: ldc.i4.5
+ IL_003b: beq.s IL_004a
+
+ IL_003d: ldloc.3
+ IL_003e: ldc.i4.s 10
+ IL_0040: beq.s IL_0050
+
+ IL_0042: br.s IL_0056
+
+ IL_0044: ldstr "zero"
+ IL_0049: ret
+
+ IL_004a: ldstr "five"
+ IL_004f: ret
+
+ IL_0050: ldstr "ten"
+ IL_0055: ret
+
+ IL_0056: ldstr "other"
+ IL_005b: ret
+ } // end of method Switch::SwitchOverNullableIntNoNullCaseShifted
+
+ .method public hidebysig static void SwitchOverInt(int32 i) cil managed
+ {
+ // Code size 125 (0x7d)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: ldarg.0
+ IL_0001: stloc.0
+ IL_0002: ldloc.0
+ IL_0003: ldc.i4.s 10
+ IL_0005: bgt.s IL_0015
+
+ IL_0007: ldloc.0
+ IL_0008: ldc.i4.0
+ IL_0009: beq.s IL_0030
+
+ IL_000b: ldloc.0
+ IL_000c: ldc.i4.5
+ IL_000d: beq.s IL_003b
+
+ IL_000f: ldloc.0
+ IL_0010: ldc.i4.s 10
+ IL_0012: beq.s IL_0046
+
+ IL_0014: ret
+
+ IL_0015: ldloc.0
+ IL_0016: ldc.i4.s 20
+ IL_0018: bgt.s IL_0025
+
+ IL_001a: ldloc.0
+ IL_001b: ldc.i4.s 15
+ IL_001d: beq.s IL_0051
+
+ IL_001f: ldloc.0
+ IL_0020: ldc.i4.s 20
+ IL_0022: beq.s IL_005c
+
+ IL_0024: ret
+
+ IL_0025: ldloc.0
+ IL_0026: ldc.i4.s 25
+ IL_0028: beq.s IL_0067
+
+ IL_002a: ldloc.0
+ IL_002b: ldc.i4.s 30
+ IL_002d: beq.s IL_0072
+
+ IL_002f: ret
+
+ IL_0030: ldstr "zero"
+ IL_0035: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003a: ret
+
+ IL_003b: ldstr "five"
+ IL_0040: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0045: ret
+
+ IL_0046: ldstr "ten"
+ IL_004b: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0050: ret
+
+ IL_0051: ldstr "fifteen"
+ IL_0056: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005b: ret
+
+ IL_005c: ldstr "twenty"
+ IL_0061: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0066: ret
+
+ IL_0067: ldstr "twenty-five"
+ IL_006c: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0071: ret
+
+ IL_0072: ldstr "thirty"
+ IL_0077: call void [mscorlib]System.Console::WriteLine(string)
+ IL_007c: ret
+ } // end of method Switch::SwitchOverInt
+
+ .method public hidebysig static string
+ ShortSwitchOverString(string text) cil managed
+ {
+ // Code size 86 (0x56)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: ldstr "ShortSwitchOverString: "
+ 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_0050
+
+ 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_003e
+
+ 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_0044
+
+ IL_002f: ldloc.0
+ IL_0030: ldstr "Third case"
+ IL_0035: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_003a: brtrue.s IL_004a
+
+ IL_003c: br.s IL_0050
+
+ IL_003e: ldstr "Text1"
+ IL_0043: ret
+
+ IL_0044: ldstr "Text2"
+ IL_0049: ret
+
+ IL_004a: ldstr "Text3"
+ IL_004f: ret
+
+ IL_0050: ldstr "Default"
+ 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
+ {
+ // Code size 227 (0xe3)
+ .maxstack 4
+ .locals init (string V_0,
+ int32 V_1)
+ IL_0000: ldstr "SwitchOverString1: "
+ 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 IL_00db
+
+ IL_0018: volatile.
+ IL_001a: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x600000b-1'
+ IL_001f: brtrue.s IL_0082
+
+ IL_0021: ldc.i4.7
+ IL_0022: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2::.ctor(int32)
+ IL_0027: dup
+ IL_0028: ldstr "First case"
+ IL_002d: ldc.i4.0
+ IL_002e: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0033: dup
+ IL_0034: ldstr "Second case"
+ IL_0039: ldc.i4.1
+ IL_003a: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_003f: dup
+ IL_0040: ldstr "2nd case"
+ IL_0045: ldc.i4.2
+ IL_0046: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_004b: dup
+ IL_004c: ldstr "Third case"
+ IL_0051: ldc.i4.3
+ IL_0052: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0057: dup
+ IL_0058: ldstr "Fourth case"
+ IL_005d: ldc.i4.4
+ IL_005e: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0063: dup
+ IL_0064: ldstr "Fifth case"
+ IL_0069: ldc.i4.5
+ IL_006a: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_006f: dup
+ IL_0070: ldstr "Sixth case"
+ IL_0075: ldc.i4.6
+ IL_0076: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_007b: volatile.
+ IL_007d: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x600000b-1'
+ IL_0082: volatile.
+ IL_0084: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x600000b-1'
+ IL_0089: ldloc.0
+ IL_008a: ldloca.s V_1
+ IL_008c: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2::TryGetValue(!0,
+ !1&)
+ IL_0091: brfalse.s IL_00dd
+
+ IL_0093: ldloc.1
+ IL_0094: switch (
+ IL_00b7,
+ IL_00bd,
+ IL_00bd,
+ IL_00c3,
+ IL_00c9,
+ IL_00cf,
+ IL_00d5)
+ IL_00b5: br.s IL_00dd
+
+ IL_00b7: ldstr "Text1"
+ IL_00bc: ret
+
+ IL_00bd: ldstr "Text2"
+ IL_00c2: ret
+
+ IL_00c3: ldstr "Text3"
+ IL_00c8: ret
+
+ IL_00c9: ldstr "Text4"
+ IL_00ce: ret
+
+ IL_00cf: ldstr "Text5"
+ IL_00d4: ret
+
+ IL_00d5: ldstr "Text6"
+ IL_00da: ret
+
+ IL_00db: ldnull
+ IL_00dc: ret
+
+ IL_00dd: ldstr "Default"
+ IL_00e2: ret
+ } // end of method Switch::SwitchOverString1
+
+ .method public hidebysig static string
+ SwitchOverString2() cil managed
+ {
+ // Code size 323 (0x143)
+ .maxstack 4
+ .locals init (string V_0,
+ 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: dup
+ IL_0010: stloc.0
+ IL_0011: brfalse IL_013d
+
+ IL_0016: volatile.
+ IL_0018: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x600000c-1'
+ IL_001d: brtrue IL_00b6
+
+ IL_0022: ldc.i4.s 11
+ IL_0024: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2::.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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ 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::Add(!0,
+ !1)
+ IL_00af: volatile.
+ IL_00b1: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x600000c-1'
+ IL_00b6: volatile.
+ IL_00b8: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x600000c-1'
+ IL_00bd: ldloc.0
+ IL_00be: ldloca.s V_1
+ IL_00c0: call instance bool class [mscorlib]System.Collections.Generic.Dictionary`2::TryGetValue(!0,
+ !1&)
+ IL_00c5: brfalse.s IL_013d
+
+ 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_00fb: ldstr "Text1"
+ IL_0100: ret
+
+ IL_0101: ldstr "Text2"
+ IL_0106: ret
+
+ IL_0107: ldstr "Text3"
+ IL_010c: ret
+
+ IL_010d: ldstr "Text4"
+ IL_0112: ret
+
+ IL_0113: ldstr "Text5"
+ IL_0118: ret
+
+ IL_0119: ldstr "Text6"
+ IL_011e: ret
+
+ IL_011f: ldstr "Text7"
+ IL_0124: ret
+
+ IL_0125: ldstr "Text8"
+ IL_012a: ret
+
+ IL_012b: ldstr "Text9"
+ IL_0130: ret
+
+ IL_0131: ldstr "Text10"
+ IL_0136: ret
+
+ IL_0137: ldstr "Text11"
+ IL_013c: ret
+
+ IL_013d: ldstr "Default"
+ IL_0142: ret
+ } // end of method Switch::SwitchOverString2
+
+ .method public hidebysig static string
+ SwitchOverBool(bool b) cil managed
+ {
+ // Code size 54 (0x36)
+ .maxstack 2
+ .locals init (bool V_0)
+ IL_0000: ldstr "SwitchOverBool: "
+ IL_0005: ldarga.s b
+ IL_0007: call instance string [mscorlib]System.Boolean::ToString()
+ IL_000c: call string [mscorlib]System.String::Concat(string,
+ string)
+ IL_0011: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0016: ldarg.0
+ IL_0017: stloc.0
+ IL_0018: ldloc.0
+ IL_0019: switch (
+ IL_002e,
+ IL_0028)
+ IL_0026: br.s IL_0034
+
+ IL_0028: ldsfld string [mscorlib]System.Boolean::TrueString
+ IL_002d: ret
+
+ IL_002e: ldsfld string [mscorlib]System.Boolean::FalseString
+ IL_0033: ret
+
+ IL_0034: ldnull
+ IL_0035: ret
+ } // end of method Switch::SwitchOverBool
+
+ .method public hidebysig static void SwitchInLoop(int32 i) cil managed
+ {
+ // Code size 112 (0x70)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: ldstr "SwitchInLoop: "
+ IL_0005: ldarg.0
+ IL_0006: box [mscorlib]System.Int32
+ IL_000b: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0010: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0015: ldarg.0
+ IL_0016: stloc.0
+ IL_0017: ldloc.0
+ IL_0018: ldc.i4.1
+ IL_0019: sub
+ IL_001a: switch (
+ IL_0031,
+ IL_003d,
+ 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_0069
+
+ IL_003d: ldstr "two"
+ IL_0042: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0047: br.s IL_0069
+
+ IL_0049: ldstr "four"
+ IL_004e: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0053: ret
+
+ 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
+ {
+ // Code size 115 (0x73)
+ .maxstack 2
+ .locals init (int32 V_0)
+ IL_0000: ldstr "SwitchWithGoto: "
+ IL_0005: ldarg.0
+ IL_0006: box [mscorlib]System.Int32
+ IL_000b: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0010: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0015: ldarg.0
+ IL_0016: stloc.0
+ IL_0017: ldloc.0
+ IL_0018: ldc.i4.1
+ IL_0019: sub
+ IL_001a: switch (
+ IL_0031,
+ IL_003d,
+ IL_0047,
+ IL_0053)
+ IL_002f: br.s IL_005e
+
+ IL_0031: ldstr "one"
+ IL_0036: call void [mscorlib]System.Console::WriteLine(string)
+ IL_003b: br.s IL_005e
+
+ IL_003d: ldstr "two"
+ IL_0042: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0047: ldstr "three"
+ IL_004c: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0051: br.s IL_0068
+
+ IL_0053: ldstr "four"
+ IL_0058: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005d: ret
+
+ IL_005e: ldstr "default"
+ IL_0063: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0068: ldstr "End of method"
+ IL_006d: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0072: ret
+ } // end of method Switch::SwitchWithGoto
+
+ .method private hidebysig static class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty[]
+ GetProperties() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldc.i4.0
+ IL_0001: newarr ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty
+ IL_0006: ret
+ } // end of method Switch::GetProperties
+
+ .method public hidebysig static void SwitchOnStringInForLoop() cil managed
+ {
+ // Code size 299 (0x12b)
+ .maxstack 4
+ .locals init (class [mscorlib]System.Collections.Generic.List`1 V_0,
+ class [mscorlib]System.Collections.Generic.List`1 V_1,
+ class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty[] V_2,
+ int32 V_3,
+ class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty V_4,
+ string V_5,
+ int32 V_6)
+ IL_0000: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor()
+ IL_0005: stloc.0
+ IL_0006: newobj instance void class [mscorlib]System.Collections.Generic.List`1::.ctor()
+ IL_000b: stloc.1
+ IL_000c: call class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty[] ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch::GetProperties()
+ IL_0011: stloc.2
+ IL_0012: ldc.i4.0
+ IL_0013: stloc.3
+ IL_0014: br IL_0121
+
+ IL_0019: ldloc.2
+ IL_001a: ldloc.3
+ IL_001b: ldelem.ref
+ IL_001c: stloc.s V_4
+ 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: 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 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x6000011-1'
+ IL_0039: brtrue.s IL_0090
+
+ IL_003b: ldc.i4.6
+ IL_003c: newobj instance void class [mscorlib]System.Collections.Generic.Dictionary`2::.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::Add(!0,
+ !1)
+ IL_004d: dup
+ IL_004e: ldstr "Name2"
+ IL_0053: ldc.i4.1
+ IL_0054: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0059: dup
+ IL_005a: ldstr "Name3"
+ IL_005f: ldc.i4.2
+ IL_0060: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0065: dup
+ IL_0066: ldstr "Name4"
+ IL_006b: ldc.i4.3
+ IL_006c: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0071: dup
+ IL_0072: ldstr "Name5"
+ IL_0077: ldc.i4.4
+ IL_0078: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_007d: dup
+ IL_007e: ldstr "Name6"
+ IL_0083: ldc.i4.5
+ IL_0084: call instance void class [mscorlib]System.Collections.Generic.Dictionary`2::Add(!0,
+ !1)
+ IL_0089: volatile.
+ IL_008b: stsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x6000011-1'
+ IL_0090: volatile.
+ IL_0092: ldsfld class [mscorlib]System.Collections.Generic.Dictionary`2 '{96F356C7-71A4-48B4-BE55-B48554E94654}'::'$$method0x6000011-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::TryGetValue(!0,
+ !1&)
+ 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::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::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::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::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::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::Add(!0)
+ IL_011d: ldloc.3
+ IL_011e: ldc.i4.1
+ IL_011f: add
+ IL_0120: stloc.3
+ IL_0121: ldloc.3
+ 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
+ {
+ // Code size 130 (0x82)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldlen
+ IL_0002: conv.i4
+ IL_0003: brfalse.s IL_000a
+
+ IL_0005: ldarg.0
+ IL_0006: ldc.i4.0
+ IL_0007: ldelem.ref
+ IL_0008: br.s IL_000f
+
+ IL_000a: ldstr "dummy"
+ IL_000f: dup
+ IL_0010: stloc.0
+ IL_0011: brfalse.s IL_0077
+
+ IL_0013: ldloc.0
+ IL_0014: ldstr "a"
+ IL_0019: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_001e: brtrue.s IL_0049
+
+ IL_0020: ldloc.0
+ IL_0021: ldstr "b"
+ IL_0026: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_002b: brtrue.s IL_0055
+
+ IL_002d: ldloc.0
+ IL_002e: ldstr "c"
+ IL_0033: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0038: brtrue.s IL_0061
+
+ IL_003a: ldloc.0
+ IL_003b: ldstr "d"
+ IL_0040: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0045: brtrue.s IL_006d
+
+ IL_0047: br.s IL_0077
+
+ IL_0049: ldstr "a"
+ IL_004e: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0053: br.s IL_0077
+
+ IL_0055: ldstr "b"
+ IL_005a: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005f: br.s IL_0077
+
+ IL_0061: ldstr "c"
+ IL_0066: call void [mscorlib]System.Console::WriteLine(string)
+ IL_006b: br.s IL_0077
+
+ IL_006d: ldstr "d"
+ IL_0072: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0077: ldstr "end"
+ IL_007c: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0081: ret
+ } // end of method Switch::SwitchWithComplexCondition
+
+ .method public hidebysig static void SwitchWithArray(string[] args) cil managed
+ {
+ // Code size 118 (0x76)
+ .maxstack 2
+ .locals init (string V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldc.i4.0
+ IL_0002: ldelem.ref
+ IL_0003: dup
+ IL_0004: stloc.0
+ IL_0005: brfalse.s IL_006b
+
+ IL_0007: ldloc.0
+ IL_0008: ldstr "a"
+ IL_000d: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0012: brtrue.s IL_003d
+
+ IL_0014: ldloc.0
+ IL_0015: ldstr "b"
+ IL_001a: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_001f: brtrue.s IL_0049
+
+ IL_0021: ldloc.0
+ IL_0022: ldstr "c"
+ IL_0027: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_002c: brtrue.s IL_0055
+
+ IL_002e: ldloc.0
+ IL_002f: ldstr "d"
+ IL_0034: call bool [mscorlib]System.String::op_Equality(string,
+ string)
+ IL_0039: brtrue.s IL_0061
+
+ IL_003b: br.s IL_006b
+
+ IL_003d: ldstr "a"
+ IL_0042: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0047: br.s IL_006b
+
+ IL_0049: ldstr "b"
+ IL_004e: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0053: br.s IL_006b
+
+ IL_0055: ldstr "c"
+ IL_005a: call void [mscorlib]System.Console::WriteLine(string)
+ IL_005f: br.s IL_006b
+
+ IL_0061: ldstr "d"
+ IL_0066: call void [mscorlib]System.Console::WriteLine(string)
+ IL_006b: ldstr "end"
+ IL_0070: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0075: ret
+ } // end of method Switch::SwitchWithArray
+
+} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
+
+.class private auto ansi '{96F356C7-71A4-48B4-BE55-B48554E94654}'
+ 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 '$$method0x600000b-1'
+ .field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2 '$$method0x600000c-1'
+ .field static assembly class [mscorlib]System.Collections.Generic.Dictionary`2 '$$method0x6000011-1'
+} // end of class '{96F356C7-71A4-48B4-BE55-B48554E94654}'
+
+
+// =============================================================
+
+// *********** DISASSEMBLY COMPLETE ***********************
+// Warnung: Win32-Ressourcendatei "../../../TestCases/Pretty\Switch.opt.res" wurde erstellt.
diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.roslyn.il
new file mode 100644
index 000000000..3c4b7ec5b
--- /dev/null
+++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.opt.roslyn.il
@@ -0,0 +1,1414 @@
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
+// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
+
+
+
+// Metadata version: v4.0.30319
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly Switch
+{
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ // --- The following custom attribute is added automatically, do not uncomment -------
+ // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 )
+
+ .permissionset reqmin
+ = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}}
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module Switch.dll
+// MVID: {4366DF41-DCD0-42E1-B99D-7B67787ECEA9}
+.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: 0x00690000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public abstract auto ansi sealed beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch
+ extends [mscorlib]System.Object
+{
+ .class auto ansi nested public beforefieldinit SetProperty
+ extends [mscorlib]System.Object
+ {
+ .field public initonly class [mscorlib]System.Reflection.PropertyInfo Property
+ .field private int32 'k__BackingField'
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .method public hidebysig specialname
+ instance int32 get_Set() cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::'k__BackingField'
+ IL_0006: ret
+ } // end of method SetProperty::get_Set
+
+ .method public hidebysig specialname
+ instance void set_Set(int32 'value') cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 8 (0x8)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: stfld int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::'k__BackingField'
+ IL_0007: ret
+ } // end of method SetProperty::set_Set
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor(class [mscorlib]System.Reflection.PropertyInfo 'property') cil managed
+ {
+ // Code size 14 (0xe)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ldarg.0
+ IL_0007: ldarg.1
+ IL_0008: stfld class [mscorlib]System.Reflection.PropertyInfo ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::Property
+ IL_000d: ret
+ } // end of method SetProperty::.ctor
+
+ .property instance int32 Set()
+ {
+ .get instance int32 ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::get_Set()
+ .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.Switch/SetProperty::set_Set(int32)
+ } // end of property SetProperty::Set
+ } // end of class SetProperty
+
+ .method public hidebysig static string
+ SparseIntegerSwitch(int32 i) cil managed
+ {
+ // Code size 185 (0xb9)
+ .maxstack 2
+ IL_0000: ldstr "SparseIntegerSwitch: "
+ IL_0005: ldarg.0
+ IL_0006: box [mscorlib]System.Int32
+ IL_000b: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0010: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0015: ldarg.0
+ IL_0016: ldc.i4.4
+ IL_0017: bgt.s IL_0048
+
+ IL_0019: ldarg.0
+ IL_001a: ldc.i4 0xff676980
+ IL_001f: beq.s IL_0071
+
+ IL_0021: ldarg.0
+ IL_0022: ldc.i4.s -100
+ IL_0024: beq.s IL_0077
+
+ IL_0026: ldarg.0
+ IL_0027: ldc.i4.m1
+ IL_0028: sub
+ IL_0029: switch (
+ IL_007d,
+ IL_0083,
+ IL_0089,
+ IL_008f,
+ IL_00b3,
+ IL_0095)
+ IL_0046: br.s IL_00b3
+
+ IL_0048: ldarg.0
+ IL_0049: ldc.i4 0x2710
+ IL_004e: bgt.s IL_005f
+
+ IL_0050: ldarg.0
+ IL_0051: ldc.i4.s 100
+ IL_0053: beq.s IL_009b
+
+ IL_0055: ldarg.0
+ IL_0056: ldc.i4 0x2710
+ IL_005b: beq.s IL_00a1
+
+ IL_005d: br.s IL_00b3
+
+ IL_005f: ldarg.0
+ IL_0060: ldc.i4 0x2711
+ IL_0065: beq.s IL_00a7
+
+ IL_0067: ldarg.0
+ IL_0068: ldc.i4 0x7fffffff
+ IL_006d: beq.s IL_00ad
+
+ IL_006f: br.s IL_00b3
+
+ IL_0071: ldstr "-10 mln"
+ IL_0076: ret
+
+ IL_0077: ldstr "-hundred"
+ IL_007c: ret
+
+ IL_007d: ldstr "-1"
+ IL_0082: ret
+
+ IL_0083: ldstr "0"
+ IL_0088: ret
+
+ IL_0089: ldstr "1"
+ IL_008e: ret
+
+ IL_008f: ldstr "2"
+ IL_0094: ret
+
+ IL_0095: ldstr "4"
+ IL_009a: ret
+
+ IL_009b: ldstr "hundred"
+ IL_00a0: ret
+
+ IL_00a1: ldstr "ten thousand"
+ IL_00a6: ret
+
+ IL_00a7: ldstr "ten thousand and one"
+ IL_00ac: ret
+
+ IL_00ad: ldstr "int.MaxValue"
+ IL_00b2: ret
+
+ IL_00b3: ldstr "something else"
+ IL_00b8: ret
+ } // end of method Switch::SparseIntegerSwitch
+
+ .method public hidebysig static string
+ SwitchOverNullableInt(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 63 (0x3f)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: stloc.0
+ IL_0002: ldloca.s V_0
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brfalse.s IL_0021
+
+ IL_000b: ldloca.s V_0
+ IL_000d: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0012: stloc.1
+ IL_0013: ldloc.1
+ IL_0014: brfalse.s IL_0027
+
+ IL_0016: ldloc.1
+ IL_0017: ldc.i4.5
+ IL_0018: beq.s IL_002d
+
+ IL_001a: ldloc.1
+ IL_001b: ldc.i4.s 10
+ IL_001d: beq.s IL_0033
+
+ IL_001f: br.s IL_0039
+
+ IL_0021: ldstr "null"
+ IL_0026: ret
+
+ IL_0027: ldstr "zero"
+ IL_002c: ret
+
+ IL_002d: ldstr "five"
+ IL_0032: ret
+
+ IL_0033: ldstr "ten"
+ IL_0038: ret
+
+ IL_0039: ldstr "large"
+ IL_003e: ret
+ } // end of method Switch::SwitchOverNullableInt
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNullCaseCombined(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 57 (0x39)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: stloc.0
+ IL_0002: ldloca.s V_0
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brfalse.s IL_0021
+
+ IL_000b: ldloca.s V_0
+ IL_000d: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0012: stloc.1
+ IL_0013: ldloc.1
+ IL_0014: brfalse.s IL_0021
+
+ IL_0016: ldloc.1
+ IL_0017: ldc.i4.5
+ IL_0018: beq.s IL_0027
+
+ IL_001a: ldloc.1
+ IL_001b: ldc.i4.s 10
+ IL_001d: beq.s IL_002d
+
+ IL_001f: br.s IL_0033
+
+ IL_0021: ldstr "zero"
+ IL_0026: ret
+
+ IL_0027: ldstr "five"
+ IL_002c: ret
+
+ IL_002d: ldstr "ten"
+ IL_0032: ret
+
+ IL_0033: ldstr "large"
+ IL_0038: ret
+ } // end of method Switch::SwitchOverNullableIntNullCaseCombined
+
+ .method public hidebysig static string
+ SwitchOverNullableIntShifted(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 98 (0x62)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: ldarg.0
+ IL_0001: stloc.1
+ IL_0002: ldloca.s V_1
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brtrue.s IL_0016
+
+ IL_000b: ldloca.s V_2
+ IL_000d: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0013: ldloc.2
+ IL_0014: br.s IL_0024
+
+ IL_0016: ldloca.s V_1
+ IL_0018: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001d: ldc.i4.5
+ IL_001e: add
+ IL_001f: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0024: stloc.0
+ IL_0025: ldloca.s V_0
+ IL_0027: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_002c: brfalse.s IL_0044
+
+ IL_002e: ldloca.s V_0
+ IL_0030: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0035: stloc.3
+ IL_0036: ldloc.3
+ IL_0037: brfalse.s IL_004a
+
+ IL_0039: ldloc.3
+ IL_003a: ldc.i4.5
+ IL_003b: beq.s IL_0050
+
+ IL_003d: ldloc.3
+ IL_003e: ldc.i4.s 10
+ IL_0040: beq.s IL_0056
+
+ IL_0042: br.s IL_005c
+
+ IL_0044: ldstr "null"
+ IL_0049: ret
+
+ IL_004a: ldstr "zero"
+ IL_004f: ret
+
+ IL_0050: ldstr "five"
+ IL_0055: ret
+
+ IL_0056: ldstr "ten"
+ IL_005b: ret
+
+ IL_005c: ldstr "large"
+ IL_0061: ret
+ } // end of method Switch::SwitchOverNullableIntShifted
+
+ .method public hidebysig static string
+ SwitchOverNullableIntShiftedNullCaseCombined(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 92 (0x5c)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: ldarg.0
+ IL_0001: stloc.1
+ IL_0002: ldloca.s V_1
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brtrue.s IL_0016
+
+ IL_000b: ldloca.s V_2
+ IL_000d: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0013: ldloc.2
+ IL_0014: br.s IL_0024
+
+ IL_0016: ldloca.s V_1
+ IL_0018: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_001d: ldc.i4.5
+ IL_001e: add
+ IL_001f: newobj instance void valuetype [mscorlib]System.Nullable`1::.ctor(!0)
+ IL_0024: stloc.0
+ IL_0025: ldloca.s V_0
+ IL_0027: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_002c: brfalse.s IL_0044
+
+ IL_002e: ldloca.s V_0
+ IL_0030: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0035: stloc.3
+ IL_0036: ldloc.3
+ IL_0037: brfalse.s IL_0044
+
+ IL_0039: ldloc.3
+ IL_003a: ldc.i4.5
+ IL_003b: beq.s IL_004a
+
+ IL_003d: ldloc.3
+ IL_003e: ldc.i4.s 10
+ IL_0040: beq.s IL_0050
+
+ IL_0042: br.s IL_0056
+
+ IL_0044: ldstr "zero"
+ IL_0049: ret
+
+ IL_004a: ldstr "five"
+ IL_004f: ret
+
+ IL_0050: ldstr "ten"
+ IL_0055: ret
+
+ IL_0056: ldstr "large"
+ IL_005b: ret
+ } // end of method Switch::SwitchOverNullableIntShiftedNullCaseCombined
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNoNullCase(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 57 (0x39)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ int32 V_1)
+ IL_0000: ldarg.0
+ IL_0001: stloc.0
+ IL_0002: ldloca.s V_0
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brfalse.s IL_0033
+
+ IL_000b: ldloca.s V_0
+ IL_000d: call instance !0 valuetype [mscorlib]System.Nullable`1::GetValueOrDefault()
+ IL_0012: stloc.1
+ IL_0013: ldloc.1
+ IL_0014: brfalse.s IL_0021
+
+ IL_0016: ldloc.1
+ IL_0017: ldc.i4.5
+ IL_0018: beq.s IL_0027
+
+ IL_001a: ldloc.1
+ IL_001b: ldc.i4.s 10
+ IL_001d: beq.s IL_002d
+
+ IL_001f: br.s IL_0033
+
+ IL_0021: ldstr "zero"
+ IL_0026: ret
+
+ IL_0027: ldstr "five"
+ IL_002c: ret
+
+ IL_002d: ldstr "ten"
+ IL_0032: ret
+
+ IL_0033: ldstr "other"
+ IL_0038: ret
+ } // end of method Switch::SwitchOverNullableIntNoNullCase
+
+ .method public hidebysig static string
+ SwitchOverNullableIntNoNullCaseShifted(valuetype [mscorlib]System.Nullable`1 i) cil managed
+ {
+ // Code size 92 (0x5c)
+ .maxstack 2
+ .locals init (valuetype [mscorlib]System.Nullable`1 V_0,
+ valuetype [mscorlib]System.Nullable`1 V_1,
+ valuetype [mscorlib]System.Nullable`1 V_2,
+ int32 V_3)
+ IL_0000: ldarg.0
+ IL_0001: stloc.1
+ IL_0002: ldloca.s V_1
+ IL_0004: call instance bool valuetype [mscorlib]System.Nullable`1::get_HasValue()
+ IL_0009: brtrue.s IL_0016
+
+ IL_000b: ldloca.s V_2
+ IL_000d: initobj valuetype [mscorlib]System.Nullable`1
+ IL_0013: ldloc.2
+ IL_0014: br.s IL_0024
+
+ IL_0016: ldloca.s V_1
+ IL_0018: call instance !0 valuetype [mscorlib]System.Nullable`1