mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/gh-710-expire-func-type-check'
* origin/topic/jsiwek/gh-710-expire-func-type-check: GH-710: Check that &expire_func is a function and not hook/event
This commit is contained in:
commit
b687730a01
5 changed files with 31 additions and 1 deletions
|
@ -512,10 +512,19 @@ void Attributes::CheckAttr(Attr* a)
|
|||
const auto& expire_func = a->GetExpr();
|
||||
|
||||
if ( expire_func->GetType()->Tag() != TYPE_FUNC )
|
||||
{
|
||||
Error("&expire_func attribute is not a function");
|
||||
break;
|
||||
}
|
||||
|
||||
const FuncType* e_ft = expire_func->GetType()->AsFuncType();
|
||||
|
||||
if ( e_ft->Flavor() != FUNC_FLAVOR_FUNCTION )
|
||||
{
|
||||
Error("&expire_func attribute is not a function");
|
||||
break;
|
||||
}
|
||||
|
||||
if ( e_ft->Yield()->Tag() != TYPE_INTERVAL )
|
||||
{
|
||||
Error("&expire_func must yield a value of type interval");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue