mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

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; });
13 lines
233 B
Text
13 lines
233 B
Text
# @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");
|
|
}
|