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}]")); }
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 ); } } }
public static bool IsDeprecated(this IDeprecatable deprecatable) { return(deprecatable.DeprecationMessage != null || deprecatable.Parent != null && deprecatable.Parent.IsDeprecated()); }