mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Scope: store IntrusivePtr in local
This commit is contained in:
parent
6e0d331267
commit
785ff57d11
6 changed files with 16 additions and 28 deletions
11
src/Scope.cc
11
src/Scope.cc
|
@ -40,9 +40,6 @@ Scope::Scope(IntrusivePtr<ID> id, attr_list* al)
|
|||
|
||||
Scope::~Scope()
|
||||
{
|
||||
for ( const auto& entry : local )
|
||||
Unref(entry.second);
|
||||
|
||||
if ( attrs )
|
||||
{
|
||||
for ( const auto& attr : *attrs )
|
||||
|
@ -101,7 +98,7 @@ void Scope::Describe(ODesc* d) const
|
|||
|
||||
for ( const auto& entry : local )
|
||||
{
|
||||
ID* id = entry.second;
|
||||
ID* id = entry.second.get();
|
||||
id->Describe(d);
|
||||
d->NL();
|
||||
}
|
||||
|
@ -111,7 +108,7 @@ TraversalCode Scope::Traverse(TraversalCallback* cb) const
|
|||
{
|
||||
for ( const auto& entry : local )
|
||||
{
|
||||
ID* id = entry.second;
|
||||
ID* id = entry.second.get();
|
||||
TraversalCode tc = id->Traverse(cb);
|
||||
HANDLE_TC_STMT_PRE(tc);
|
||||
}
|
||||
|
@ -176,11 +173,11 @@ IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
|
|||
auto id = make_intrusive<ID>(full_name.data(), scope, is_export);
|
||||
|
||||
if ( SCOPE_FUNCTION != scope )
|
||||
global_scope()->Insert(std::move(full_name), IntrusivePtr{id}.release());
|
||||
global_scope()->Insert(std::move(full_name), id);
|
||||
else
|
||||
{
|
||||
id->SetOffset(top_scope->Length());
|
||||
top_scope->Insert(std::move(full_name), IntrusivePtr{id}.release());
|
||||
top_scope->Insert(std::move(full_name), id);
|
||||
}
|
||||
|
||||
return id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue