mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Allow iterating over bif functions with result type vector of any.
This changes the internal type that is used to signal that a vector is unspecified from any to void. I tried to verify that the behavior of Bro is still the same. After a lot of playing around, I think everything still should worl as before. However, it might be good for someone to take a look at this. addresses BIT-1144
This commit is contained in:
parent
58eb9bbf28
commit
b3bd509b3f
11 changed files with 66 additions and 7 deletions
17
src/Type.cc
17
src/Type.cc
|
@ -1626,6 +1626,21 @@ VectorType::~VectorType()
|
|||
Unref(yield_type);
|
||||
}
|
||||
|
||||
BroType* VectorType::YieldType()
|
||||
{
|
||||
// cheat around the fact that we use void internally to
|
||||
// mark a vector as being unspecified
|
||||
if ( IsUnspecifiedVector() )
|
||||
{
|
||||
BroType* ret = ::base_type(TYPE_ANY);
|
||||
Unref(ret); // unref, because this won't be held by anyone.
|
||||
assert(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return yield_type;
|
||||
}
|
||||
|
||||
int VectorType::MatchesIndex(ListExpr*& index) const
|
||||
{
|
||||
expr_list& el = index->Exprs();
|
||||
|
@ -1645,7 +1660,7 @@ int VectorType::MatchesIndex(ListExpr*& index) const
|
|||
|
||||
bool VectorType::IsUnspecifiedVector() const
|
||||
{
|
||||
return yield_type->Tag() == TYPE_ANY;
|
||||
return yield_type->Tag() == TYPE_VOID;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIAL(VectorType, SER_VECTOR_TYPE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue