Add deprecation expression to deprecated prototype/parameter messages

This commit is contained in:
Jon Siwek 2020-07-09 21:25:35 -07:00
parent ac1ec7668d
commit 8597b998bb
7 changed files with 58 additions and 25 deletions

View file

@ -40,6 +40,18 @@ Attr::Attr(AttrTag t)
void Attr::SetAttrExpr(ExprPtr e)
{ expr = std::move(e); }
std::string Attr::DeprecationMessage() const
{
if ( tag != ATTR_DEPRECATED )
return "";
if ( ! expr )
return "";
auto ce = static_cast<zeek::detail::ConstExpr*>(expr.get());
return ce->Value()->AsStringVal()->CheckString();
}
void Attr::Describe(ODesc* d) const
{
AddTag(d);