示例#1
0
文件: MessageID.cs 项目: belav/roslyn
 internal static CSDiagnosticInfo?GetFeatureAvailabilityDiagnosticInfo(
     this MessageID feature,
     CSharpParseOptions options
     ) =>
 options.IsFeatureEnabled(feature)
       ? null
       : GetDisabledFeatureDiagnosticInfo(feature, options.LanguageVersion);
示例#2
0
        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)));
        }