mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Fix is/as operators on vector values
This commit is contained in:
parent
4bd6da7186
commit
3a824a06ed
4 changed files with 24 additions and 2 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 88242c8ca0e8745df1fe6ba115b54d9f5c160095
|
Subproject commit 054eac298890a6de6eed8c6d9395ccf0f829054a
|
|
@ -455,7 +455,7 @@ Val* UnaryExpr::Eval(Frame* f) const
|
||||||
if ( ! v )
|
if ( ! v )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ( is_vector(v) )
|
if ( is_vector(v) && Tag() != EXPR_IS && Tag() != EXPR_CAST )
|
||||||
{
|
{
|
||||||
VectorVal* v_op = v->AsVectorVal();
|
VectorVal* v_op = v->AsVectorVal();
|
||||||
VectorType* out_t;
|
VectorType* out_t;
|
||||||
|
|
4
testing/btest/Baseline/language.type-check-vector/output
Normal file
4
testing/btest/Baseline/language.type-check-vector/output
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
T
|
||||||
|
[one, two, 3]
|
||||||
|
T
|
||||||
|
[one, two, three]
|
18
testing/btest/language/type-check-vector.bro
Normal file
18
testing/btest/language/type-check-vector.bro
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# @TEST-EXEC: bro -b %INPUT >output 2>&1
|
||||||
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||||
|
|
||||||
|
type myvec: vector of any;
|
||||||
|
|
||||||
|
function check(a: any)
|
||||||
|
{
|
||||||
|
print a is myvec;
|
||||||
|
print a as myvec;
|
||||||
|
}
|
||||||
|
|
||||||
|
event bro_init()
|
||||||
|
{
|
||||||
|
local v = myvec("one", "two", 3);
|
||||||
|
check(v);
|
||||||
|
local sv = string_vec("one", "two", "three");
|
||||||
|
check(sv);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue