mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Deprecate ListVal::ConvertToSet(), add ListVal::ToSetVal()
This commit is contained in:
parent
2cfbbd8cdb
commit
df65d1e829
4 changed files with 15 additions and 12 deletions
|
@ -1226,7 +1226,7 @@ void ListVal::Append(Val* v)
|
|||
type->AsTypeList()->Append({NewRef{}, v->Type()});
|
||||
}
|
||||
|
||||
TableVal* ListVal::ConvertToSet() const
|
||||
IntrusivePtr<TableVal> ListVal::ToSetVal() const
|
||||
{
|
||||
if ( tag == TYPE_ANY )
|
||||
Internal("conversion of heterogeneous list to set");
|
||||
|
@ -1235,7 +1235,7 @@ TableVal* ListVal::ConvertToSet() const
|
|||
IntrusivePtr{NewRef{}, type->AsTypeList()->PureType()});
|
||||
set_index->Append(base_type(tag));
|
||||
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
||||
TableVal* t = new TableVal(std::move(s));
|
||||
auto t = make_intrusive<TableVal>(std::move(s));
|
||||
|
||||
for ( const auto& val : vals )
|
||||
t->Assign(val, nullptr);
|
||||
|
@ -1243,6 +1243,11 @@ TableVal* ListVal::ConvertToSet() const
|
|||
return t;
|
||||
}
|
||||
|
||||
TableVal* ListVal::ConvertToSet() const
|
||||
{
|
||||
return ToSetVal().release();
|
||||
}
|
||||
|
||||
void ListVal::Describe(ODesc* d) const
|
||||
{
|
||||
if ( d->IsBinary() || d->IsPortable() )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue