mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Deprecate VectorVal(VectorType*) ctora
Adds a new one taking an IntrusivePtr.
This commit is contained in:
parent
c5236ecaee
commit
d4dba40727
51 changed files with 171 additions and 160 deletions
24
src/Expr.cc
24
src/Expr.cc
|
@ -361,7 +361,7 @@ IntrusivePtr<Val> UnaryExpr::Eval(Frame* f) const
|
|||
else
|
||||
out_t = Type()->AsVectorType();
|
||||
|
||||
auto result = make_intrusive<VectorVal>(out_t);
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, out_t});
|
||||
|
||||
for ( unsigned int i = 0; i < v_op->Size(); ++i )
|
||||
{
|
||||
|
@ -454,7 +454,7 @@ IntrusivePtr<Val> BinaryExpr::Eval(Frame* f) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto v_result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto v_result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
for ( unsigned int i = 0; i < v_op1->Size(); ++i )
|
||||
{
|
||||
|
@ -471,7 +471,7 @@ IntrusivePtr<Val> BinaryExpr::Eval(Frame* f) const
|
|||
if ( IsVector(Type()->Tag()) && (is_vec1 || is_vec2) )
|
||||
{ // fold vector against scalar
|
||||
VectorVal* vv = (is_vec1 ? v1 : v2)->AsVectorVal();
|
||||
auto v_result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto v_result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
for ( unsigned int i = 0; i < vv->Size(); ++i )
|
||||
{
|
||||
|
@ -1583,7 +1583,7 @@ IntrusivePtr<Val> BoolExpr::Eval(Frame* f) const
|
|||
|
||||
if ( scalar_v->IsZero() == is_and )
|
||||
{
|
||||
result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
result->Resize(vector_v->Size());
|
||||
result->AssignRepeat(0, result->Size(), scalar_v.get());
|
||||
}
|
||||
|
@ -1608,7 +1608,7 @@ IntrusivePtr<Val> BoolExpr::Eval(Frame* f) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
result->Resize(vec_v1->Size());
|
||||
|
||||
for ( unsigned int i = 0; i < vec_v1->Size(); ++i )
|
||||
|
@ -1940,7 +1940,7 @@ IntrusivePtr<Val> CondExpr::Eval(Frame* f) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
result->Resize(cond->Size());
|
||||
|
||||
for ( unsigned int i = 0; i < cond->Size(); ++i )
|
||||
|
@ -2592,7 +2592,7 @@ IntrusivePtr<Val> IndexExpr::Eval(Frame* f) const
|
|||
{
|
||||
VectorVal* v_v1 = v1->AsVectorVal();
|
||||
VectorVal* v_v2 = indv->AsVectorVal();
|
||||
auto v_result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto v_result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
// Booleans select each element (or not).
|
||||
if ( IsBool(v_v2->Type()->Yield()->Tag()) )
|
||||
|
@ -2659,7 +2659,7 @@ IntrusivePtr<Val> IndexExpr::Fold(Val* v1, Val* v2) const
|
|||
else
|
||||
{
|
||||
size_t len = vect->Size();
|
||||
auto result = make_intrusive<VectorVal>(vect->Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, vect->Type()->AsVectorType()});
|
||||
|
||||
bro_int_t first = get_slice_index(lv->Idx(0)->CoerceToInt(), len);
|
||||
bro_int_t last = get_slice_index(lv->Idx(1)->CoerceToInt(), len);
|
||||
|
@ -3352,7 +3352,7 @@ IntrusivePtr<Val> VectorConstructorExpr::Eval(Frame* f) const
|
|||
if ( IsError() )
|
||||
return nullptr;
|
||||
|
||||
auto vec = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto vec = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||
|
||||
loop_over_list(exprs, i)
|
||||
|
@ -3377,7 +3377,7 @@ IntrusivePtr<Val> VectorConstructorExpr::InitVal(const BroType* t, IntrusivePtr<
|
|||
VectorType* vt = Type()->AsVectorType();
|
||||
auto vec = aggr ?
|
||||
IntrusivePtr<VectorVal>{AdoptRef{}, aggr.release()->AsVectorVal()} :
|
||||
make_intrusive<VectorVal>(vt);
|
||||
make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, vt});
|
||||
const expr_list& exprs = op->AsListExpr()->Exprs();
|
||||
|
||||
loop_over_list(exprs, i)
|
||||
|
@ -3514,7 +3514,7 @@ IntrusivePtr<Val> ArithCoerceExpr::Fold(Val* v) const
|
|||
t = Type()->AsVectorType()->Yield()->InternalType();
|
||||
|
||||
VectorVal* vv = v->AsVectorVal();
|
||||
auto result = make_intrusive<VectorVal>(Type()->AsVectorType());
|
||||
auto result = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
|
||||
for ( unsigned int i = 0; i < vv->Size(); ++i )
|
||||
{
|
||||
|
@ -3794,7 +3794,7 @@ IntrusivePtr<Val> VectorCoerceExpr::Fold(Val* v) const
|
|||
if ( vv->Size() > 0 )
|
||||
RuntimeErrorWithCallStack("coercion of non-empty vector");
|
||||
|
||||
return make_intrusive<VectorVal>(Type()->Ref()->AsVectorType());
|
||||
return make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, Type()->AsVectorType()});
|
||||
}
|
||||
|
||||
FlattenExpr::FlattenExpr(IntrusivePtr<Expr> arg_op)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue