mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Change record field anonymous functions to use lambda expressions
There was an alternate syntax to assign anonymous functions to record fields that was never migrated to use the new lambda expression machinery (and so didn't allow referencing variables in outer scope): type myrec: record { foo: function(a: string); }; local o = "o"; local mr = myrec($foo(a: string) = { print a + o; });
This commit is contained in:
parent
66156b4eee
commit
f032885085
5 changed files with 40 additions and 35 deletions
13
testing/btest/language/lambda-record-field.zeek
Normal file
13
testing/btest/language/lambda-record-field.zeek
Normal file
|
@ -0,0 +1,13 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
type myrec: record {
|
||||
foo: function(a: string);
|
||||
};
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local w = "world";
|
||||
local mr = myrec($foo(a: string) = { print a + w; });
|
||||
mr$foo("hello");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue