mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
Improve alternate event/hook prototype matching
This fixes it to again allow the old behavior of matching a handler against the canonical prototype as long as all argument types, but not necessarily names, match.
This commit is contained in:
parent
8c0e8ecd28
commit
9b6934eab8
5 changed files with 85 additions and 8 deletions
|
@ -1,2 +1,2 @@
|
|||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.alternate-event-hook-prototypes-invalid-arg/alternate-event-hook-prototypes-invalid-arg.zeek, line 5 and /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.alternate-event-hook-prototypes-invalid-arg/alternate-event-hook-prototypes-invalid-arg.zeek, line 4: alternate function prototype already exists (event(nope:string; cantdothis:count;) and record { s:string; c:count; })
|
||||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.alternate-event-hook-prototypes-invalid-arg/alternate-event-hook-prototypes-invalid-arg.zeek, line 5 and /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.alternate-event-hook-prototypes-invalid-arg/alternate-event-hook-prototypes-invalid-arg.zeek, line 4: alternate function prototype arg 'nope' not found in canonical prototype (event(nope:string; cantdothis:count;) and event(s:string; c:count;))
|
||||
error in /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.alternate-event-hook-prototypes-invalid-arg/alternate-event-hook-prototypes-invalid-arg.zeek, line 8 and /home/jon/pro/zeek/zeek/testing/btest/.tmp/language.alternate-event-hook-prototypes-invalid-arg/alternate-event-hook-prototypes-invalid-arg.zeek, line 7: alternate function prototype arg 'andnotthiseither' not found in canonical prototype (hook(andnotthiseither:addr;) : bool and hook(s:string; c:count;) : bool)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
foo, A, B, C
|
||||
foo, A, B, C
|
||||
reverse foo, A, B, C
|
||||
foo a, A
|
||||
foo b, B
|
||||
foo c, C
|
|
@ -0,0 +1,44 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT > out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
global foo: event(a: string, b: string, c: string);
|
||||
global foo: event(c: string, b: string, a: string);
|
||||
global foo: event(a: string);
|
||||
global foo: event(b: string);
|
||||
global foo: event(c: string);
|
||||
|
||||
event foo(a: string, b: string, c: string)
|
||||
{
|
||||
print "foo", a, b, c;
|
||||
}
|
||||
|
||||
event foo(mya: string, b: string, c: string)
|
||||
{
|
||||
print "foo", mya, b, c;
|
||||
}
|
||||
|
||||
event foo(c: string, b: string, a: string)
|
||||
{
|
||||
print "reverse foo", a, b, c;
|
||||
}
|
||||
|
||||
event foo(a: string)
|
||||
{
|
||||
print "foo a", a;
|
||||
}
|
||||
|
||||
event foo(b: string)
|
||||
{
|
||||
print "foo b", b;
|
||||
}
|
||||
|
||||
event foo(c: string)
|
||||
{
|
||||
print "foo c", c;
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
event foo("A", "B", "C");
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue