internal static CSDiagnosticInfo?GetFeatureAvailabilityDiagnosticInfo( this MessageID feature, CSharpParseOptions options ) => options.IsFeatureEnabled(feature) ? null : GetDisabledFeatureDiagnosticInfo(feature, options.LanguageVersion);
internal static CSDiagnosticInfo GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpParseOptions options) { LanguageVersion requiredVersion; if (options.IsFeatureEnabled(feature)) { return(null); } string requiredFeature = feature.RequiredFeature(); if (requiredFeature != null) { return(new CSDiagnosticInfo(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature)); } LanguageVersion availableVersion = options.LanguageVersion; requiredVersion = feature.RequiredVersion(); return(requiredVersion == LanguageVersion.Preview.MapSpecifiedToEffectiveVersion() ? new CSDiagnosticInfo(ErrorCode.ERR_FeatureInPreview, feature.Localize()) : new CSDiagnosticInfo(availableVersion.GetErrorCode(), feature.Localize(), new CSharpRequiredLanguageVersion(requiredVersion))); }