Browse Source

Add SparseIntegerSwitch option.

pull/2145/head
Daniel Grunwald 5 years ago
parent
commit
3d10509b1b
  1. 15
      ICSharpCode.Decompiler/DecompilerSettings.cs
  2. 2
      ICSharpCode.Decompiler/IL/ControlFlow/SwitchDetection.cs
  3. 9
      ILSpy/Properties/Resources.Designer.cs
  4. 3
      ILSpy/Properties/Resources.resx

15
ICSharpCode.Decompiler/DecompilerSettings.cs

@ -599,6 +599,21 @@ namespace ICSharpCode.Decompiler @@ -599,6 +599,21 @@ namespace ICSharpCode.Decompiler
}
}
bool sparseIntegerSwitch = true;
[Category("C# 1.0 / VS .NET")]
[Description("DecompilerSettings.SparseIntegerSwitch")]
public bool SparseIntegerSwitch {
get { return sparseIntegerSwitch; }
set {
if (sparseIntegerSwitch != value)
{
sparseIntegerSwitch = value;
OnPropertyChanged();
}
}
}
bool usingDeclarations = true;
[Category("C# 1.0 / VS .NET")]

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

@ -134,6 +134,8 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow @@ -134,6 +134,8 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
public void Run(ILFunction function, ILTransformContext context)
{
if (!context.Settings.SparseIntegerSwitch)
return;
this.context = context;
analysis.AllowUnreachableCases = context.Settings.RemoveDeadCode;

9
ILSpy/Properties/Resources.Designer.cs generated

@ -1091,6 +1091,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -1091,6 +1091,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Detect switch on integer even if IL code does not use a jump table.
/// </summary>
public static string DecompilerSettings_SparseIntegerSwitch {
get {
return ResourceManager.GetString("DecompilerSettings.SparseIntegerSwitch", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Switch expressions.
/// </summary>

3
ILSpy/Properties/Resources.resx

@ -393,6 +393,9 @@ Are you sure you want to continue?</value> @@ -393,6 +393,9 @@ Are you sure you want to continue?</value>
<data name="DecompilerSettings.ShowInfoFromDebugSymbolsIfAvailable" xml:space="preserve">
<value>Show info from debug symbols, if available</value>
</data>
<data name="DecompilerSettings.SparseIntegerSwitch" xml:space="preserve">
<value>Detect switch on integer even if IL code does not use a jump table</value>
</data>
<data name="DecompilerSettings.SwitchExpressions" xml:space="preserve">
<value>Switch expressions</value>
</data>

Loading…
Cancel
Save