Browse Source

Add DecompilerSettings.ThrowExpressions

pull/1600/head
Siegfried Pammer 6 years ago
parent
commit
62c4635cb8
  1. 20
      ICSharpCode.Decompiler/DecompilerSettings.cs
  2. 9
      ILSpy/Properties/Resources.Designer.cs
  3. 3
      ILSpy/Properties/Resources.resx

20
ICSharpCode.Decompiler/DecompilerSettings.cs

@ -88,6 +88,7 @@ namespace ICSharpCode.Decompiler @@ -88,6 +88,7 @@ namespace ICSharpCode.Decompiler
}
if (languageVersion < CSharp.LanguageVersion.CSharp7) {
outVariables = false;
throwExpressions = false;
tupleTypes = false;
tupleConversions = false;
discards = false;
@ -117,7 +118,7 @@ namespace ICSharpCode.Decompiler @@ -117,7 +118,7 @@ namespace ICSharpCode.Decompiler
if (introduceRefModifiersOnStructs || introduceReadonlyAndInModifiers || nonTrailingNamedArguments)
return CSharp.LanguageVersion.CSharp7_2;
// C# 7.1 missing
if (outVariables || tupleTypes || tupleConversions || discards || localFunctions)
if (outVariables || throwExpressions || tupleTypes || tupleConversions || discards || localFunctions)
return CSharp.LanguageVersion.CSharp7;
if (awaitInCatchFinally || useExpressionBodyForCalculatedGetterOnlyProperties || nullPropagation
|| stringInterpolation || dictionaryInitializers || extensionMethodsInCollectionInitializers)
@ -856,6 +857,23 @@ namespace ICSharpCode.Decompiler @@ -856,6 +857,23 @@ namespace ICSharpCode.Decompiler
}
}
bool throwExpressions = true;
/// <summary>
/// Gets/Sets whether throw expressions should be used.
/// </summary>
[Category("C# 7.0 / VS 2017")]
[Description("DecompilerSettings.UseThrowExpressions")]
public bool ThrowExpressions {
get { return throwExpressions; }
set {
if (throwExpressions != value) {
throwExpressions = value;
OnPropertyChanged();
}
}
}
bool tupleConversions = true;
/// <summary>

9
ILSpy/Properties/Resources.Designer.cs generated

@ -908,6 +908,15 @@ namespace ICSharpCode.ILSpy.Properties { @@ -908,6 +908,15 @@ namespace ICSharpCode.ILSpy.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Use throw expressions.
/// </summary>
public static string DecompilerSettings_UseThrowExpressions {
get {
return ResourceManager.GetString("DecompilerSettings.UseThrowExpressions", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use tuple type syntax.
/// </summary>

3
ILSpy/Properties/Resources.resx

@ -729,4 +729,7 @@ @@ -729,4 +729,7 @@
<data name="CannotAnalyzeMissingRef" xml:space="preserve">
<value>Entity could not be resolved. Cannot analyze entities from missing assembly references. Add the missing reference and try again.</value>
</data>
<data name="DecompilerSettings.UseThrowExpressions" xml:space="preserve">
<value>Use throw expressions</value>
</data>
</root>
Loading…
Cancel
Save