mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/misc-lambda-fixes'
* origin/topic/jsiwek/misc-lambda-fixes: GH-725: fix logic for finding a lambda's usage of outer IDs Change record field anonymous functions to use lambda expressions
This commit is contained in:
commit
3ce1c9ffd6
12 changed files with 103 additions and 58 deletions
2
testing/btest/Baseline/language.lambda-nested-copy/out
Normal file
2
testing/btest/Baseline/language.lambda-nested-copy/out
Normal file
|
@ -0,0 +1,2 @@
|
|||
106
|
||||
106
|
1
testing/btest/Baseline/language.lambda-record-field/out
Normal file
1
testing/btest/Baseline/language.lambda-record-field/out
Normal file
|
@ -0,0 +1 @@
|
|||
helloworld
|
|
@ -39,7 +39,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -134,7 +134,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -241,7 +241,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -468,7 +468,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -593,7 +593,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -718,7 +718,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -843,7 +843,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -968,7 +968,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -1198,7 +1198,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -1251,7 +1251,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -1304,7 +1304,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -1357,7 +1357,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -1410,7 +1410,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
@ -1463,7 +1463,7 @@ print A::outfile, Left;
|
|||
print A::outfile, A::left;
|
||||
print A::outfile, Right;
|
||||
print A::outfile, A::right;
|
||||
}, pred=anonymous-function
|
||||
}, pred=lambda_<10906653936191056190>
|
||||
{
|
||||
print A::outfile, ============PREDICATE============;
|
||||
print A::outfile, A::typ;
|
||||
|
|
19
testing/btest/language/lambda-nested-copy.zeek
Normal file
19
testing/btest/language/lambda-nested-copy.zeek
Normal file
|
@ -0,0 +1,19 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
local outer = 100;
|
||||
|
||||
local lambda = function()
|
||||
{
|
||||
local inner = function(a: count, b: count, c: count, d: count, e: count, f: count)
|
||||
{
|
||||
print outer + f;
|
||||
};
|
||||
|
||||
inner(1, 2, 3, 4, 5, 6);
|
||||
};
|
||||
|
||||
lambda();
|
||||
|
||||
local copyLambda = copy(copy(copy(lambda)));
|
||||
copyLambda();
|
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