mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
parsing of new []-style captures, and creation of associated data structures
This commit is contained in:
parent
f673f85acc
commit
955384291d
3 changed files with 107 additions and 13 deletions
18
src/Type.cc
18
src/Type.cc
|
@ -622,6 +622,8 @@ FuncType::FuncType(RecordTypePtr arg_args,
|
|||
}
|
||||
|
||||
prototypes.emplace_back(Prototype{false, "", args, std::move(offsets)});
|
||||
|
||||
captures = nullptr;
|
||||
}
|
||||
|
||||
TypePtr FuncType::ShallowClone()
|
||||
|
@ -632,6 +634,7 @@ TypePtr FuncType::ShallowClone()
|
|||
f->yield = yield;
|
||||
f->flavor = flavor;
|
||||
f->prototypes = prototypes;
|
||||
f->captures = captures;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -654,7 +657,15 @@ string FuncType::FlavorString() const
|
|||
}
|
||||
}
|
||||
|
||||
FuncType::~FuncType() = default;
|
||||
FuncType::~FuncType()
|
||||
{
|
||||
if ( captures )
|
||||
{
|
||||
for ( auto c : *captures )
|
||||
delete c;
|
||||
delete captures;
|
||||
}
|
||||
}
|
||||
|
||||
int FuncType::MatchesIndex(detail::ListExpr* const index) const
|
||||
{
|
||||
|
@ -698,6 +709,11 @@ bool FuncType::CheckArgs(const std::vector<TypePtr>& args,
|
|||
return success;
|
||||
}
|
||||
|
||||
void FuncType::SetCaptures(std::vector<Capture*>* _captures)
|
||||
{
|
||||
captures = _captures;
|
||||
}
|
||||
|
||||
void FuncType::Describe(ODesc* d) const
|
||||
{
|
||||
if ( d->IsReadable() )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue