|
|
|
@ -84,6 +84,7 @@ namespace ICSharpCode.Decompiler
@@ -84,6 +84,7 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
} |
|
|
|
|
if (languageVersion < CSharp.LanguageVersion.CSharp7_2) { |
|
|
|
|
introduceRefAndReadonlyModifiersOnStructs = false; |
|
|
|
|
nonTrailingNamedArguments = false; |
|
|
|
|
} |
|
|
|
|
if (languageVersion < CSharp.LanguageVersion.CSharp7_3) { |
|
|
|
|
//introduceUnmanagedTypeConstraint = false;
|
|
|
|
@ -91,6 +92,29 @@ namespace ICSharpCode.Decompiler
@@ -91,6 +92,29 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CSharp.LanguageVersion GetMinimumRequiredVersion() |
|
|
|
|
{ |
|
|
|
|
if (tupleComparisons) |
|
|
|
|
return CSharp.LanguageVersion.CSharp7_3; |
|
|
|
|
if (IntroduceRefAndReadonlyModifiersOnStructs || nonTrailingNamedArguments) |
|
|
|
|
return CSharp.LanguageVersion.CSharp7_2; |
|
|
|
|
// C# 7.1 missing
|
|
|
|
|
if (outVariables || tupleTypes || tupleConversions || discards) |
|
|
|
|
return CSharp.LanguageVersion.CSharp7; |
|
|
|
|
if (awaitInCatchFinally || useExpressionBodyForCalculatedGetterOnlyProperties || nullPropagation |
|
|
|
|
|| stringInterpolation || dictionaryInitializers || extensionMethodsInCollectionInitializers) |
|
|
|
|
return CSharp.LanguageVersion.CSharp6; |
|
|
|
|
if (asyncAwait) |
|
|
|
|
return CSharp.LanguageVersion.CSharp5; |
|
|
|
|
if (dynamic || namedArguments || optionalArguments) |
|
|
|
|
return CSharp.LanguageVersion.CSharp4; |
|
|
|
|
if (anonymousTypes || objectCollectionInitializers || automaticProperties || queryExpressions || expressionTrees) |
|
|
|
|
return CSharp.LanguageVersion.CSharp3; |
|
|
|
|
if (anonymousMethods || liftNullables || yieldReturn || useImplicitMethodGroupConversion) |
|
|
|
|
return CSharp.LanguageVersion.CSharp2; |
|
|
|
|
return CSharp.LanguageVersion.CSharp1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool anonymousMethods = true; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -688,6 +712,21 @@ namespace ICSharpCode.Decompiler
@@ -688,6 +712,21 @@ namespace ICSharpCode.Decompiler
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool nonTrailingNamedArguments = true; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets/Sets whether C# 7.2 non-trailing named arguments should be used.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool NonTrailingNamedArguments { |
|
|
|
|
get { return nonTrailingNamedArguments; } |
|
|
|
|
set { |
|
|
|
|
if (nonTrailingNamedArguments != value) { |
|
|
|
|
nonTrailingNamedArguments = value; |
|
|
|
|
OnPropertyChanged(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool optionalArguments = true; |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|