mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 14:08:20 +00:00
Merge remote-tracking branch 'origin/topic/bernhard/ticket-1144'
* origin/topic/bernhard/ticket-1144: Allow iterating over bif functions with result type vector of any. BIT-1144 #merged
This commit is contained in:
commit
7774af7518
13 changed files with 74 additions and 7 deletions
19
src/Type.cc
19
src/Type.cc
|
@ -1626,6 +1626,23 @@ VectorType::~VectorType()
|
|||
Unref(yield_type);
|
||||
}
|
||||
|
||||
BroType* VectorType::YieldType()
|
||||
{
|
||||
// Work around the fact that we use void internally to mark a vector
|
||||
// as being unspecified. When looking at its yield type, we need to
|
||||
// return any as that's what other code historically expects for type
|
||||
// comparisions.
|
||||
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 +1662,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