mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Add Attributes ctor that takes IntrusivePtrs
This commit is contained in:
parent
102e58b80b
commit
ccd1cbbc54
6 changed files with 87 additions and 14 deletions
22
src/Expr.cc
22
src/Expr.cc
|
@ -3087,7 +3087,16 @@ TableConstructorExpr::TableConstructorExpr(IntrusivePtr<ListExpr> constructor_li
|
|||
}
|
||||
}
|
||||
|
||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : nullptr;
|
||||
if ( arg_attrs )
|
||||
{
|
||||
std::vector<IntrusivePtr<Attr>> attrv;
|
||||
|
||||
for ( auto& a : *arg_attrs )
|
||||
attrv.emplace_back(AdoptRef{}, a);
|
||||
|
||||
attrs = new Attributes(std::move(attrv), type, false, false);
|
||||
delete arg_attrs;
|
||||
}
|
||||
|
||||
const auto& indices = type->AsTableType()->GetIndices()->Types();
|
||||
const expr_list& cle = op->AsListExpr()->Exprs();
|
||||
|
@ -3206,7 +3215,16 @@ SetConstructorExpr::SetConstructorExpr(IntrusivePtr<ListExpr> constructor_list,
|
|||
else if ( type->Tag() != TYPE_TABLE || ! type->AsTableType()->IsSet() )
|
||||
SetError("values in set(...) constructor do not specify a set");
|
||||
|
||||
attrs = arg_attrs ? new Attributes(arg_attrs, type, false, false) : nullptr;
|
||||
if ( arg_attrs )
|
||||
{
|
||||
std::vector<IntrusivePtr<Attr>> attrv;
|
||||
|
||||
for ( auto& a : *arg_attrs )
|
||||
attrv.emplace_back(AdoptRef{}, a);
|
||||
|
||||
attrs = new Attributes(std::move(attrv), type, false, false);
|
||||
delete arg_attrs;
|
||||
}
|
||||
|
||||
const auto& indices = type->AsTableType()->GetIndices()->Types();
|
||||
expr_list& cle = op->AsListExpr()->Exprs();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue