示例#1
0
        public static string GetDeprecationMessage(this IDeprecatable deprecatable)
        {
            var message = deprecatable.DeprecationMessage;

            if (!string.IsNullOrEmpty(message))
            {
                return(message);
            }
            return(deprecatable.Parent?.GetDeprecationMessage());
        }
        public static T WriteObsoleteAttributeWhenObsolete <T>(this T writerWrapper, IDeprecatable deprecatable)
            where T : IWriterWrapper
        {
            if (!deprecatable.IsDeprecated())
            {
                return(writerWrapper);
            }

            var message      = deprecatable.GetDeprecationMessage();
            var obsoleteText = string.IsNullOrEmpty(message) ? string.Empty : $"(\"{message}\")";

            return(writerWrapper.WriteLine($"[Obsolete{obsoleteText}]"));
        }
示例#3
0
 void CheckDeprecated(IDeprecatable info, INamedXObject namedObj)
 {
     if (info.IsDeprecated)
     {
         if (string.IsNullOrEmpty(info.DeprecationMessage))
         {
             Document.Diagnostics.Add(
                 CoreDiagnostics.Deprecated,
                 namedObj.NameSpan,
                 DescriptionFormatter.GetKindNoun(info),
                 info.Name);
         }
         else
         {
             Document.Diagnostics.Add(
                 CoreDiagnostics.DeprecatedWithMessage,
                 namedObj.NameSpan,
                 DescriptionFormatter.GetKindNoun(info),
                 info.Name,
                 info.DeprecationMessage
                 );
         }
     }
 }
示例#4
0
 public static bool IsDeprecated(this IDeprecatable deprecatable)
 {
     return(deprecatable.DeprecationMessage != null || deprecatable.Parent != null && deprecatable.Parent.IsDeprecated());
 }