mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
ID: Add AddAttr() helper
This is just a follow-up as code cleanup, but not required to be backported to 5.1.
This commit is contained in:
parent
ef920ef3f5
commit
da5fdb2072
5 changed files with 13 additions and 17 deletions
15
src/ID.cc
15
src/ID.cc
|
@ -311,8 +311,7 @@ void ID::MakeDeprecated(ExprPtr deprecation)
|
|||
if ( IsDeprecated() )
|
||||
return;
|
||||
|
||||
std::vector<AttrPtr> attrv{make_intrusive<Attr>(ATTR_DEPRECATED, std::move(deprecation))};
|
||||
AddAttrs(make_intrusive<Attributes>(std::move(attrv), GetType(), false, IsGlobal()));
|
||||
AddAttr(make_intrusive<Attr>(ATTR_DEPRECATED, std::move(deprecation)));
|
||||
}
|
||||
|
||||
std::string ID::GetDeprecationWarning() const
|
||||
|
@ -329,6 +328,13 @@ std::string ID::GetDeprecationWarning() const
|
|||
return util::fmt("deprecated (%s): %s", Name(), result.c_str());
|
||||
}
|
||||
|
||||
void ID::AddAttr(AttrPtr a, bool is_redef)
|
||||
{
|
||||
std::vector<AttrPtr> attrv{std::move(a)};
|
||||
auto attrs = make_intrusive<Attributes>(std::move(attrv), GetType(), false, IsGlobal());
|
||||
AddAttrs(std::move(attrs), is_redef);
|
||||
}
|
||||
|
||||
void ID::AddAttrs(AttributesPtr a, bool is_redef)
|
||||
{
|
||||
if ( attrs )
|
||||
|
@ -354,10 +360,7 @@ void ID::SetOption()
|
|||
|
||||
// option implied redefinable
|
||||
if ( ! IsRedefinable() )
|
||||
{
|
||||
std::vector<AttrPtr> attrv{make_intrusive<Attr>(ATTR_REDEF)};
|
||||
AddAttrs(make_intrusive<Attributes>(std::move(attrv), GetType(), false, IsGlobal()));
|
||||
}
|
||||
AddAttr(make_intrusive<Attr>(ATTR_REDEF));
|
||||
}
|
||||
|
||||
void ID::EvalFunc(ExprPtr ef, ExprPtr ev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue