mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 04:58:21 +00:00
Hook functions now directly callable instead of w/ "hook" statements.
The return value of the call is an implicit boolean value of T if all hook handlers ran, or F if one hook handler exited as a result of a break statement and potentially prevented other handlers from running. Scripts don't need to declare hooks with an explicit return type of bool (internally, that's assumed), and any values given to (optional) return statements in handler definitions are just ignored. Addresses #918.
This commit is contained in:
parent
e2fdf16e0c
commit
378ee699ff
15 changed files with 108 additions and 145 deletions
|
@ -294,12 +294,12 @@ void add_type(ID* id, BroType* t, attr_list* attr, int /* is_event */)
|
|||
void begin_func(ID* id, const char* module_name, function_flavor flavor,
|
||||
int is_redef, FuncType* t)
|
||||
{
|
||||
if ( flavor == FUNC_FLAVOR_EVENT || flavor == FUNC_FLAVOR_HOOK )
|
||||
if ( flavor == FUNC_FLAVOR_EVENT )
|
||||
{
|
||||
const BroType* yt = t->YieldType();
|
||||
|
||||
if ( yt && yt->Tag() != TYPE_VOID )
|
||||
id->Error("event/hook cannot yield a value", t);
|
||||
id->Error("event cannot yield a value", t);
|
||||
|
||||
t->ClearYieldType(flavor);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue