mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Move Frame and Scope to zeek::detail namespace
This commit is contained in:
parent
64332ca22c
commit
937a462e70
50 changed files with 306 additions and 257 deletions
35
src/Var.cc
35
src/Var.cc
|
@ -350,7 +350,7 @@ zeek::detail::StmtPtr add_local(
|
|||
|
||||
else
|
||||
{
|
||||
current_scope()->AddInit(std::move(id));
|
||||
zeek::detail::current_scope()->AddInit(std::move(id));
|
||||
return zeek::make_intrusive<zeek::detail::NullStmt>();
|
||||
}
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ void begin_func(zeek::detail::IDPtr id, const char* module_name,
|
|||
else
|
||||
id->SetType(t);
|
||||
|
||||
push_scope(std::move(id), std::move(attrs));
|
||||
zeek::detail::push_scope(std::move(id), std::move(attrs));
|
||||
|
||||
const auto& args = t->Params();
|
||||
int num_args = args->NumFields();
|
||||
|
@ -576,26 +576,26 @@ void begin_func(zeek::detail::IDPtr id, const char* module_name,
|
|||
for ( int i = 0; i < num_args; ++i )
|
||||
{
|
||||
zeek::TypeDecl* arg_i = args->FieldDecl(i);
|
||||
auto arg_id = lookup_ID(arg_i->id, module_name);
|
||||
auto arg_id = zeek::detail::lookup_ID(arg_i->id, module_name);
|
||||
|
||||
if ( arg_id && ! arg_id->IsGlobal() )
|
||||
arg_id->Error("argument name used twice");
|
||||
|
||||
arg_id = install_ID(arg_i->id, module_name, false, false);
|
||||
arg_id = zeek::detail::install_ID(arg_i->id, module_name, false, false);
|
||||
arg_id->SetType(arg_i->type);
|
||||
|
||||
if ( prototype )
|
||||
arg_id->SetOffset(prototype->offsets[i]);
|
||||
}
|
||||
|
||||
if ( zeek::detail::Attr* depr_attr = find_attr(current_scope()->Attrs().get(),
|
||||
if ( zeek::detail::Attr* depr_attr = find_attr(zeek::detail::current_scope()->Attrs().get(),
|
||||
zeek::detail::ATTR_DEPRECATED) )
|
||||
current_scope()->GetID()->MakeDeprecated(depr_attr->GetExpr());
|
||||
zeek::detail::current_scope()->GetID()->MakeDeprecated(depr_attr->GetExpr());
|
||||
}
|
||||
|
||||
class OuterIDBindingFinder : public TraversalCallback {
|
||||
public:
|
||||
OuterIDBindingFinder(Scope* s)
|
||||
OuterIDBindingFinder(zeek::detail::Scope* s)
|
||||
{
|
||||
scopes.emplace_back(s);
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ public:
|
|||
TraversalCode PreExpr(const zeek::detail::Expr*) override;
|
||||
TraversalCode PostExpr(const zeek::detail::Expr*) override;
|
||||
|
||||
std::vector<Scope*> scopes;
|
||||
std::vector<zeek::detail::Scope*> scopes;
|
||||
std::vector<const zeek::detail::NameExpr*> outer_id_references;
|
||||
};
|
||||
|
||||
|
@ -644,7 +644,8 @@ TraversalCode OuterIDBindingFinder::PostExpr(const zeek::detail::Expr* expr)
|
|||
|
||||
void end_func(zeek::detail::StmtPtr body)
|
||||
{
|
||||
auto ingredients = std::make_unique<function_ingredients>(pop_scope(), std::move(body));
|
||||
auto ingredients = std::make_unique<function_ingredients>(zeek::detail::pop_scope(),
|
||||
std::move(body));
|
||||
|
||||
if ( ingredients->id->HasVal() )
|
||||
ingredients->id->GetVal()->AsFunc()->AddBody(
|
||||
|
@ -677,7 +678,7 @@ zeek::Val* internal_val(const char* name)
|
|||
return zeek::id::find_val(name).get();
|
||||
}
|
||||
|
||||
id_list gather_outer_ids(Scope* scope, zeek::detail::Stmt* body)
|
||||
id_list gather_outer_ids(zeek::detail::Scope* scope, zeek::detail::Stmt* body)
|
||||
{
|
||||
OuterIDBindingFinder cb(scope);
|
||||
body->Traverse(&cb);
|
||||
|
@ -704,13 +705,13 @@ zeek::Val* internal_const_val(const char* name)
|
|||
|
||||
zeek::Val* opt_internal_val(const char* name)
|
||||
{
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = zeek::detail::lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
return id ? id->GetVal().get() : nullptr;
|
||||
}
|
||||
|
||||
double opt_internal_double(const char* name)
|
||||
{
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = zeek::detail::lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0.0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalDouble() : 0.0;
|
||||
|
@ -718,7 +719,7 @@ double opt_internal_double(const char* name)
|
|||
|
||||
bro_int_t opt_internal_int(const char* name)
|
||||
{
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = zeek::detail::lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalInt() : 0;
|
||||
|
@ -726,7 +727,7 @@ bro_int_t opt_internal_int(const char* name)
|
|||
|
||||
bro_uint_t opt_internal_unsigned(const char* name)
|
||||
{
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = zeek::detail::lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalUnsigned() : 0;
|
||||
|
@ -734,7 +735,7 @@ bro_uint_t opt_internal_unsigned(const char* name)
|
|||
|
||||
zeek::StringVal* opt_internal_string(const char* name)
|
||||
{
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = zeek::detail::lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return nullptr;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->AsStringVal() : nullptr;
|
||||
|
@ -742,7 +743,7 @@ zeek::StringVal* opt_internal_string(const char* name)
|
|||
|
||||
zeek::TableVal* opt_internal_table(const char* name)
|
||||
{
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = zeek::detail::lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return nullptr;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->AsTableVal() : nullptr;
|
||||
|
@ -750,7 +751,7 @@ zeek::TableVal* opt_internal_table(const char* name)
|
|||
|
||||
zeek::ListVal* internal_list_val(const char* name)
|
||||
{
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = zeek::detail::lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id )
|
||||
return nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue