mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
GH-1741: Print error if calling a non-hook with hook keyword
This commit is contained in:
parent
c15a9eab7f
commit
b966a3876f
3 changed files with 20 additions and 9 deletions
|
@ -721,8 +721,12 @@ expr:
|
|||
{
|
||||
--in_hook;
|
||||
set_location(@1, @3);
|
||||
|
||||
if ( $3->Tag() != EXPR_CALL )
|
||||
$3->Error("not a valid hook call expression");
|
||||
else if ( $3->AsCallExpr()->Func()->GetType()->AsFuncType()->Flavor() != FUNC_FLAVOR_HOOK )
|
||||
$3->Error("hook keyword should only be used to call hooks");
|
||||
|
||||
$$ = $3;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue