zeek/testing/btest/language/lambda-record-field.zeek
Jon Siwek f032885085 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; });
2020-03-26 15:48:18 -07:00

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");
}