mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Allow serialization of closures over Broker.
anonymous-functions, their closures, can now be sent over broker. In order to send an anonymous function the receiver must have parsed a definition of the functon, but it need not to have been evaluated. See testing/btest/language/closure-sending.zeek for an example of how this can be done. This also sends their closures as well as the closures of regular functions.
This commit is contained in:
parent
f18464f1f8
commit
f0798c4b49
19 changed files with 1060 additions and 160 deletions
|
@ -1234,11 +1234,8 @@ 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.
|
||||
// Gather the ingredients for a BroFunc from the current scope
|
||||
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