mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Remove Func::AsScriptFunc() methods
Not used frequently enough, so possibly better to minimize leakage of details from non-detail API.
This commit is contained in:
parent
4824da0325
commit
70ff4ef678
4 changed files with 8 additions and 12 deletions
|
@ -63,12 +63,6 @@ public:
|
|||
|
||||
~Func() override;
|
||||
|
||||
zeek::detail::ScriptFunc* AsScriptFunc()
|
||||
{ return GetKind() == SCRIPT_FUNC ? (detail::ScriptFunc*) this : nullptr; }
|
||||
|
||||
const zeek::detail::ScriptFunc* AsScriptFunc() const
|
||||
{ return GetKind() == SCRIPT_FUNC ? (detail::ScriptFunc*) this : nullptr; }
|
||||
|
||||
virtual bool IsPure() const = 0;
|
||||
FunctionFlavor Flavor() const { return GetType()->Flavor(); }
|
||||
|
||||
|
|
|
@ -738,10 +738,10 @@ void end_func(StmtPtr body)
|
|||
ingredients->id->SetConst();
|
||||
}
|
||||
|
||||
auto func = ingredients->id->GetVal()->AsFunc()->AsScriptFunc();
|
||||
auto func = cast_intrusive<ScriptFunc>(ingredients->id->GetVal()->AsFuncPtr());
|
||||
func->SetScope(ingredients->scope);
|
||||
|
||||
analyze_func({NewRef{}, func});
|
||||
analyze_func(std::move(func));
|
||||
|
||||
// Note: ideally, something would take ownership of this memory until the
|
||||
// end of script execution, but that's essentially the same as the
|
||||
|
|
|
@ -175,11 +175,13 @@ ExprPtr Inliner::CheckForInlining(IntrusivePtr<CallExpr> c)
|
|||
if ( ! func_v )
|
||||
return c;
|
||||
|
||||
auto func_vf = func_v->AsFunc()->AsScriptFunc();
|
||||
auto function = func_v->AsFunc();
|
||||
|
||||
if ( ! func_vf )
|
||||
if ( function->GetKind() != Func::SCRIPT_FUNC )
|
||||
return c;
|
||||
|
||||
auto func_vf = static_cast<ScriptFunc*>(function);
|
||||
|
||||
if ( inline_ables.count(func_vf) == 0 )
|
||||
return c;
|
||||
|
||||
|
|
|
@ -146,10 +146,10 @@ TraversalCode ProfileFunc::PreExpr(const Expr* e)
|
|||
if ( func_v )
|
||||
{
|
||||
auto func_vf = func_v->AsFunc();
|
||||
auto bf = func_vf->AsScriptFunc();
|
||||
|
||||
if ( bf )
|
||||
if ( func_vf->GetKind() == Func::SCRIPT_FUNC )
|
||||
{
|
||||
auto bf = static_cast<ScriptFunc*>(func_vf);
|
||||
script_calls.insert(bf);
|
||||
|
||||
if ( in_when )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue