mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Change Scope/Func inits from id_list* to vector<IntrusivePtr<ID>>
This commit is contained in:
parent
46e23b49fb
commit
2cee468eac
8 changed files with 48 additions and 91 deletions
21
src/Scope.cc
21
src/Scope.cc
|
@ -21,8 +21,6 @@ Scope::Scope(IntrusivePtr<ID> id,
|
|||
{
|
||||
return_type = nullptr;
|
||||
|
||||
inits = new id_list;
|
||||
|
||||
if ( id )
|
||||
{
|
||||
const auto& id_type = scope_id->GetType();
|
||||
|
@ -37,17 +35,6 @@ Scope::Scope(IntrusivePtr<ID> id,
|
|||
}
|
||||
}
|
||||
|
||||
Scope::~Scope()
|
||||
{
|
||||
if ( inits )
|
||||
{
|
||||
for ( const auto& i : *inits )
|
||||
Unref(i);
|
||||
|
||||
delete inits;
|
||||
}
|
||||
}
|
||||
|
||||
const IntrusivePtr<ID>& Scope::Find(std::string_view name) const
|
||||
{
|
||||
auto entry = local.find(name);
|
||||
|
@ -77,11 +64,11 @@ IntrusivePtr<ID> Scope::GenerateTemporary(const char* name)
|
|||
return make_intrusive<ID>(name, SCOPE_FUNCTION, false);
|
||||
}
|
||||
|
||||
id_list* Scope::GetInits()
|
||||
std::vector<IntrusivePtr<ID>> Scope::GetInits()
|
||||
{
|
||||
id_list* ids = inits;
|
||||
inits = nullptr;
|
||||
return ids;
|
||||
auto rval = std::move(inits);
|
||||
inits = {};
|
||||
return rval;
|
||||
}
|
||||
|
||||
void Scope::Describe(ODesc* d) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue