mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Allow Zeek function equality comparisons
Equality between two functions acts like a pointer comparison.
This commit is contained in:
parent
11949ce37a
commit
6e67a40d24
3 changed files with 28 additions and 0 deletions
|
@ -1762,6 +1762,7 @@ EqExpr::EqExpr(BroExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
|||
case zeek::TYPE_ADDR:
|
||||
case zeek::TYPE_SUBNET:
|
||||
case zeek::TYPE_ERROR:
|
||||
case zeek::TYPE_FUNC:
|
||||
break;
|
||||
|
||||
case zeek::TYPE_ENUM:
|
||||
|
@ -1814,6 +1815,11 @@ ValPtr EqExpr::Fold(Val* v1, Val* v2) const
|
|||
else
|
||||
return zeek::val_mgr->Bool(! re->MatchExactly(s));
|
||||
}
|
||||
else if ( op1->GetType()->Tag() == zeek::TYPE_FUNC )
|
||||
{
|
||||
auto res = v1->AsFunc() == v2->AsFunc();
|
||||
return val_mgr->Bool(tag == EXPR_EQ ? res : ! res);
|
||||
}
|
||||
|
||||
else
|
||||
return BinaryExpr::Fold(v1, v2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue