mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
ZAM fix for vector "in" operator
This commit is contained in:
parent
5569d81953
commit
6185d1c389
2 changed files with 3 additions and 5 deletions
|
@ -1593,10 +1593,8 @@ public:
|
||||||
ValPtr ValAt(unsigned int index) const { return At(index); }
|
ValPtr ValAt(unsigned int index) const { return At(index); }
|
||||||
|
|
||||||
bool Has(unsigned int index) const
|
bool Has(unsigned int index) const
|
||||||
// Version to use once std::optional implementation is merged.
|
|
||||||
// { return index < vector_val->size() && vector_val[index]; }
|
|
||||||
{
|
{
|
||||||
return At(index) != nullptr;
|
return index < vector_val->size() && (*vector_val)[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -833,13 +833,13 @@ internal-op Val-Is-In-Vector
|
||||||
type VVV
|
type VVV
|
||||||
eval auto& vec = frame[z.v3].vector_val;
|
eval auto& vec = frame[z.v3].vector_val;
|
||||||
auto ind = frame[z.v2].int_val;
|
auto ind = frame[z.v2].int_val;
|
||||||
frame[z.v1].int_val = ind >= 0 && static_cast<zeek_uint_t>(ind) < vec->Size();
|
frame[z.v1].int_val = vec->Has(ind);
|
||||||
|
|
||||||
internal-op Const-Is-In-Vector
|
internal-op Const-Is-In-Vector
|
||||||
type VCV
|
type VCV
|
||||||
eval auto& vec = frame[z.v2].vector_val;
|
eval auto& vec = frame[z.v2].vector_val;
|
||||||
auto ind = z.c.int_val;
|
auto ind = z.c.int_val;
|
||||||
frame[z.v1].int_val = ind >= 0 && static_cast<zeek_uint_t>(ind) < vec->Size();
|
frame[z.v1].int_val = vec->Has(ind);
|
||||||
|
|
||||||
expr-op Cond
|
expr-op Cond
|
||||||
type VVVV
|
type VVVV
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue