changed function_ingredients struct to FunctionIngredients class with accessors

This commit is contained in:
Vern Paxson 2023-04-02 11:34:16 -07:00
parent 5718046b96
commit 0c434ca4f8
11 changed files with 63 additions and 53 deletions

View file

@ -862,16 +862,18 @@ static std::set<EventGroupPtr> get_func_groups(const std::vector<AttrPtr>& attrs
return groups;
}
function_ingredients::function_ingredients(ScopePtr scope, StmtPtr body,
const std::string& module_name)
FunctionIngredients::FunctionIngredients(ScopePtr _scope, StmtPtr _body,
const std::string& module_name)
{
scope = std::move(_scope);
body = std::move(_body);
frame_size = scope->Length();
inits = scope->GetInits();
this->scope = std::move(scope);
id = this->scope->GetID();
id = scope->GetID();
const auto& attrs = this->scope->Attrs();
const auto& attrs = scope->Attrs();
if ( attrs )
{
@ -890,15 +892,11 @@ function_ingredients::function_ingredients(ScopePtr scope, StmtPtr body,
else
priority = 0;
this->body = std::move(body);
this->module_name = module_name;
// Implicit module event groups for events and hooks.
auto flavor = id->GetType<zeek::FuncType>()->Flavor();
if ( flavor == FUNC_FLAVOR_EVENT || flavor == FUNC_FLAVOR_HOOK )
{
auto module_group = event_registry->RegisterGroup(EventGroupKind::Module,
this->module_name);
auto module_group = event_registry->RegisterGroup(EventGroupKind::Module, module_name);
groups.insert(module_group);
}
}