mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Switch FuncType capture-list storage to optional<vector<Capture>>
May help clarify overall mem-mgmt/ownership semantics.
This commit is contained in:
parent
ab15a98b28
commit
b08112b2e7
8 changed files with 44 additions and 41 deletions
16
src/Type.cc
16
src/Type.cc
|
@ -622,8 +622,6 @@ FuncType::FuncType(RecordTypePtr arg_args,
|
|||
}
|
||||
|
||||
prototypes.emplace_back(Prototype{false, "", args, std::move(offsets)});
|
||||
|
||||
captures = nullptr;
|
||||
}
|
||||
|
||||
TypePtr FuncType::ShallowClone()
|
||||
|
@ -657,16 +655,6 @@ string FuncType::FlavorString() const
|
|||
}
|
||||
}
|
||||
|
||||
FuncType::~FuncType()
|
||||
{
|
||||
if ( captures )
|
||||
{
|
||||
for ( auto c : *captures )
|
||||
delete c;
|
||||
delete captures;
|
||||
}
|
||||
}
|
||||
|
||||
int FuncType::MatchesIndex(detail::ListExpr* const index) const
|
||||
{
|
||||
return check_and_promote_args(index, args.get()) ?
|
||||
|
@ -709,9 +697,9 @@ bool FuncType::CheckArgs(const std::vector<TypePtr>& args,
|
|||
return success;
|
||||
}
|
||||
|
||||
void FuncType::SetCaptures(std::vector<Capture*>* _captures)
|
||||
void FuncType::SetCaptures(std::optional<CaptureList> _captures)
|
||||
{
|
||||
captures = _captures;
|
||||
captures = std::move(_captures);
|
||||
}
|
||||
|
||||
void FuncType::Describe(ODesc* d) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue