mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Make ClosureFrame safe & cleanup
TODO: make anonymous-funcs associated with tables capture closures, implement copy constructor for Frame, & other cleanup.
This commit is contained in:
parent
670816ad48
commit
8ed18ca194
10 changed files with 150 additions and 149 deletions
|
@ -477,8 +477,8 @@ int get_func_priotity(attr_list* attrs)
|
|||
|
||||
void end_func(Stmt* body)
|
||||
{
|
||||
std::unique_ptr<function_ingredients> ingredients =
|
||||
gather_function_ingredients(body);
|
||||
std::unique_ptr<function_ingredients> ingredients = gather_function_ingredients(body);
|
||||
|
||||
pop_scope();
|
||||
|
||||
if ( streq(ingredients->id->Name(), "anonymous-function") )
|
||||
|
@ -505,6 +505,7 @@ void end_func(Stmt* body)
|
|||
ingredients->inits,
|
||||
ingredients->frame_size,
|
||||
ingredients->priority);
|
||||
|
||||
ingredients->id->SetVal(new Val(f));
|
||||
ingredients->id->SetConst();
|
||||
}
|
||||
|
@ -516,7 +517,8 @@ void end_func(Stmt* body)
|
|||
// function and collects it into a function_ingredients struct.
|
||||
std::unique_ptr<function_ingredients> gather_function_ingredients(Stmt* body)
|
||||
{
|
||||
std::unique_ptr<function_ingredients> ingredients (new function_ingredients);
|
||||
std::unique_ptr<function_ingredients> ingredients = build_unique<function_ingredients>();
|
||||
|
||||
ingredients->frame_size = current_scope()->Length();
|
||||
ingredients->inits = current_scope()->GetInits();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue