mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Move ID to the zeek::detail namespace
This commit is contained in:
parent
9992ec5c11
commit
0d623d003c
30 changed files with 221 additions and 182 deletions
42
src/Scope.cc
42
src/Scope.cc
|
@ -15,7 +15,7 @@ typedef PList<Scope> scope_list;
|
|||
static scope_list scopes;
|
||||
static Scope* top_scope;
|
||||
|
||||
Scope::Scope(IntrusivePtr<ID> id,
|
||||
Scope::Scope(IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> al)
|
||||
: scope_id(std::move(id)), attrs(std::move(al))
|
||||
{
|
||||
|
@ -35,17 +35,17 @@ Scope::Scope(IntrusivePtr<ID> id,
|
|||
}
|
||||
}
|
||||
|
||||
const IntrusivePtr<ID>& Scope::Find(std::string_view name) const
|
||||
const IntrusivePtr<zeek::detail::ID>& Scope::Find(std::string_view name) const
|
||||
{
|
||||
auto entry = local.find(name);
|
||||
|
||||
if ( entry != local.end() )
|
||||
return entry->second;
|
||||
|
||||
return ID::nil;
|
||||
return zeek::detail::ID::nil;
|
||||
}
|
||||
|
||||
IntrusivePtr<ID> Scope::Remove(std::string_view name)
|
||||
IntrusivePtr<zeek::detail::ID> Scope::Remove(std::string_view name)
|
||||
{
|
||||
auto entry = local.find(name);
|
||||
|
||||
|
@ -59,12 +59,12 @@ IntrusivePtr<ID> Scope::Remove(std::string_view name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
IntrusivePtr<ID> Scope::GenerateTemporary(const char* name)
|
||||
IntrusivePtr<zeek::detail::ID> Scope::GenerateTemporary(const char* name)
|
||||
{
|
||||
return make_intrusive<ID>(name, SCOPE_FUNCTION, false);
|
||||
return make_intrusive<zeek::detail::ID>(name, zeek::detail::SCOPE_FUNCTION, false);
|
||||
}
|
||||
|
||||
std::vector<IntrusivePtr<ID>> Scope::GetInits()
|
||||
std::vector<IntrusivePtr<zeek::detail::ID>> Scope::GetInits()
|
||||
{
|
||||
auto rval = std::move(inits);
|
||||
inits = {};
|
||||
|
@ -100,7 +100,7 @@ void Scope::Describe(ODesc* d) const
|
|||
|
||||
for ( const auto& entry : local )
|
||||
{
|
||||
ID* id = entry.second.get();
|
||||
zeek::detail::ID* id = entry.second.get();
|
||||
id->Describe(d);
|
||||
d->NL();
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ TraversalCode Scope::Traverse(TraversalCallback* cb) const
|
|||
{
|
||||
for ( const auto& entry : local )
|
||||
{
|
||||
ID* id = entry.second.get();
|
||||
zeek::detail::ID* id = entry.second.get();
|
||||
TraversalCode tc = id->Traverse(cb);
|
||||
HANDLE_TC_STMT_PRE(tc);
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ TraversalCode Scope::Traverse(TraversalCallback* cb) const
|
|||
}
|
||||
|
||||
|
||||
const IntrusivePtr<ID>& lookup_ID(const char* name, const char* curr_module,
|
||||
bool no_global, bool same_module_only,
|
||||
bool check_export)
|
||||
const IntrusivePtr<zeek::detail::ID>& lookup_ID(const char* name, const char* curr_module,
|
||||
bool no_global, bool same_module_only,
|
||||
bool check_export)
|
||||
{
|
||||
std::string fullname = make_full_var_name(curr_module, name);
|
||||
|
||||
|
@ -150,30 +150,30 @@ const IntrusivePtr<ID>& lookup_ID(const char* name, const char* curr_module,
|
|||
return global_scope()->Find(globalname);
|
||||
}
|
||||
|
||||
return ID::nil;
|
||||
return zeek::detail::ID::nil;
|
||||
}
|
||||
|
||||
IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
|
||||
IntrusivePtr<zeek::detail::ID> install_ID(const char* name, const char* module_name,
|
||||
bool is_global, bool is_export)
|
||||
{
|
||||
if ( scopes.empty() && ! is_global )
|
||||
reporter->InternalError("local identifier in global scope");
|
||||
|
||||
IDScope scope;
|
||||
zeek::detail::IDScope scope;
|
||||
if ( is_export || ! module_name ||
|
||||
(is_global &&
|
||||
normalized_module_name(module_name) == GLOBAL_MODULE_NAME) )
|
||||
scope = SCOPE_GLOBAL;
|
||||
scope = zeek::detail::SCOPE_GLOBAL;
|
||||
else if ( is_global )
|
||||
scope = SCOPE_MODULE;
|
||||
scope = zeek::detail::SCOPE_MODULE;
|
||||
else
|
||||
scope = SCOPE_FUNCTION;
|
||||
scope = zeek::detail::SCOPE_FUNCTION;
|
||||
|
||||
std::string full_name = make_full_var_name(module_name, name);
|
||||
|
||||
auto id = make_intrusive<ID>(full_name.data(), scope, is_export);
|
||||
auto id = make_intrusive<zeek::detail::ID>(full_name.data(), scope, is_export);
|
||||
|
||||
if ( SCOPE_FUNCTION != scope )
|
||||
if ( zeek::detail::SCOPE_FUNCTION != scope )
|
||||
global_scope()->Insert(std::move(full_name), id);
|
||||
else
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ void push_existing_scope(Scope* scope)
|
|||
scopes.push_back(scope);
|
||||
}
|
||||
|
||||
void push_scope(IntrusivePtr<ID> id,
|
||||
void push_scope(IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs)
|
||||
{
|
||||
top_scope = new Scope(std::move(id), std::move(attrs));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue