mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Type: use class IntrusivePtr in TypeList
This commit is contained in:
parent
de0289125b
commit
73cea5dcad
13 changed files with 62 additions and 74 deletions
|
@ -1185,7 +1185,7 @@ IntrusivePtr<Val> PatternVal::DoClone(CloneState* state)
|
|||
}
|
||||
|
||||
ListVal::ListVal(TypeTag t)
|
||||
: Val(new TypeList(t == TYPE_ANY ? 0 : base_type_no_ref(t)))
|
||||
: Val(new TypeList({NewRef{}, t == TYPE_ANY ? 0 : base_type_no_ref(t)}))
|
||||
{
|
||||
tag = t;
|
||||
}
|
||||
|
@ -1226,7 +1226,7 @@ void ListVal::Append(Val* v)
|
|||
}
|
||||
|
||||
vals.push_back(v);
|
||||
type->AsTypeList()->Append(v->Type()->Ref());
|
||||
type->AsTypeList()->Append({NewRef{}, v->Type()});
|
||||
}
|
||||
|
||||
TableVal* ListVal::ConvertToSet() const
|
||||
|
@ -1234,8 +1234,8 @@ TableVal* ListVal::ConvertToSet() const
|
|||
if ( tag == TYPE_ANY )
|
||||
Internal("conversion of heterogeneous list to set");
|
||||
|
||||
auto set_index = make_intrusive<TypeList>(type->AsTypeList()->PureType());
|
||||
set_index->Append(base_type(tag));
|
||||
auto set_index = make_intrusive<TypeList>(IntrusivePtr{NewRef{}, type->AsTypeList()->PureType()});
|
||||
set_index->Append({AdoptRef{}, base_type(tag)});
|
||||
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
||||
TableVal* t = new TableVal(std::move(s));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue