mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Deprecate internal_val() and internal_const_val()
Replaced with zeek::lookup_val() and zeek::lookup_const()
This commit is contained in:
parent
ac06259eec
commit
a83941d64d
10 changed files with 85 additions and 49 deletions
42
src/Var.cc
42
src/Var.cc
|
@ -657,12 +657,7 @@ void end_func(IntrusivePtr<Stmt> body)
|
|||
|
||||
Val* internal_val(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
|
||||
if ( ! id )
|
||||
reporter->InternalError("internal variable %s missing", name);
|
||||
|
||||
return id->GetVal().get();
|
||||
return zeek::lookup_val(name).get();
|
||||
}
|
||||
|
||||
id_list gather_outer_ids(Scope* scope, Stmt* body)
|
||||
|
@ -687,14 +682,7 @@ id_list gather_outer_ids(Scope* scope, Stmt* body)
|
|||
|
||||
Val* internal_const_val(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id )
|
||||
reporter->InternalError("internal variable %s missing", name);
|
||||
|
||||
if ( ! id->IsConst() )
|
||||
reporter->InternalError("internal variable %s is not constant", name);
|
||||
|
||||
return id->GetVal().get();
|
||||
return zeek::lookup_const(name).get();
|
||||
}
|
||||
|
||||
Val* opt_internal_val(const char* name)
|
||||
|
@ -765,6 +753,29 @@ BroType* internal_type(const char* name)
|
|||
return zeek::lookup_type(name).get();
|
||||
}
|
||||
|
||||
const IntrusivePtr<Val>& zeek::lookup_val(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
|
||||
if ( ! id )
|
||||
reporter->InternalError("Failed to find variable named: %s", name);
|
||||
|
||||
return id->GetVal();
|
||||
}
|
||||
|
||||
const IntrusivePtr<Val>& zeek::lookup_const(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
|
||||
if ( ! id )
|
||||
reporter->InternalError("Failed to find variable named: %s", name);
|
||||
|
||||
if ( ! id->IsConst() )
|
||||
reporter->InternalError("Variable is not 'const', but expected to be: %s", name);
|
||||
|
||||
return id->GetVal();
|
||||
}
|
||||
|
||||
const IntrusivePtr<BroType>& zeek::lookup_type(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
|
@ -776,7 +787,8 @@ const IntrusivePtr<BroType>& zeek::lookup_type(const char* name)
|
|||
|
||||
Func* internal_func(const char* name)
|
||||
{
|
||||
Val* v = internal_val(name);
|
||||
const auto& v = zeek::lookup_val(name);
|
||||
|
||||
if ( v )
|
||||
return v->AsFunc();
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue