Fix is/as operators on vector values

This commit is contained in:
Jon Siwek 2018-09-10 14:51:26 -05:00
parent 4bd6da7186
commit 3a824a06ed
4 changed files with 24 additions and 2 deletions

@ -1 +1 @@
Subproject commit 88242c8ca0e8745df1fe6ba115b54d9f5c160095
Subproject commit 054eac298890a6de6eed8c6d9395ccf0f829054a

View file

@ -455,7 +455,7 @@ Val* UnaryExpr::Eval(Frame* f) const
if ( ! v )
return 0;
if ( is_vector(v) )
if ( is_vector(v) && Tag() != EXPR_IS && Tag() != EXPR_CAST )
{
VectorVal* v_op = v->AsVectorVal();
VectorType* out_t;

View file

@ -0,0 +1,4 @@
T
[one, two, 3]
T
[one, two, three]

View 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);
}