mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Add deprecation expression to deprecated prototype/parameter messages
This commit is contained in:
parent
ac1ec7668d
commit
8597b998bb
7 changed files with 58 additions and 25 deletions
11
src/Type.cc
11
src/Type.cc
|
@ -563,7 +563,7 @@ FuncType::FuncType(RecordTypePtr arg_args,
|
|||
offsets[i] = i;
|
||||
}
|
||||
|
||||
prototypes.emplace_back(Prototype{false, args, std::move(offsets)});
|
||||
prototypes.emplace_back(Prototype{false, "", args, std::move(offsets)});
|
||||
}
|
||||
|
||||
TypePtr FuncType::ShallowClone()
|
||||
|
@ -1120,14 +1120,7 @@ string RecordType::GetFieldDeprecationWarning(int field, bool has_check) const
|
|||
{
|
||||
string result;
|
||||
if ( const auto& deprecation = decl->GetAttr(zeek::detail::ATTR_DEPRECATED) )
|
||||
{
|
||||
auto expr = static_cast<zeek::detail::ConstExpr*>(deprecation->GetExpr().get());
|
||||
if ( expr )
|
||||
{
|
||||
StringVal* text = expr->Value()->AsStringVal();
|
||||
result = text->CheckString();
|
||||
}
|
||||
}
|
||||
result = deprecation->DeprecationMessage();
|
||||
|
||||
if ( result.empty() )
|
||||
return fmt("deprecated (%s%s$%s)", GetName().c_str(), has_check ? "?" : "",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue