mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08: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
15
src/parse.y
15
src/parse.y
|
@ -1216,12 +1216,8 @@ func_body:
|
|||
;
|
||||
|
||||
anonymous_function:
|
||||
TOK_FUNCTION func_params
|
||||
{
|
||||
$<id>$ = current_scope()->GenerateTemporary("lambda-function");
|
||||
begin_func($<id>$, current_module.c_str(), FUNC_FLAVOR_FUNCTION, 0, $2);
|
||||
}
|
||||
|
||||
TOK_FUNCTION begin_func
|
||||
|
||||
'{'
|
||||
{
|
||||
saved_in_init.push_back(in_init);
|
||||
|
@ -1229,6 +1225,7 @@ anonymous_function:
|
|||
}
|
||||
|
||||
stmt_list
|
||||
|
||||
{
|
||||
in_init = saved_in_init.back();
|
||||
saved_in_init.pop_back();
|
||||
|
@ -1239,9 +1236,9 @@ anonymous_function:
|
|||
// Every time a new LambdaExpr is evaluated it must return a new instance
|
||||
// of a BroFunc. Here, we collect the ingredients for a function and give
|
||||
// it to our LambdaExpr.
|
||||
std::unique_ptr<function_ingredients> ingredients =
|
||||
gather_function_ingredients($6);
|
||||
std::shared_ptr<id_list> outer_ids = gather_outer_ids(pop_scope(), $6);
|
||||
std::unique_ptr<function_ingredients> ingredients = gather_function_ingredients($5);
|
||||
|
||||
std::shared_ptr<id_list> outer_ids = gather_outer_ids(pop_scope(), $5);
|
||||
|
||||
$$ = new LambdaExpr(std::move(ingredients), std::move(outer_ids));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue