mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 03:58:20 +00:00
fixed bug where appending an empty vector to a vector-of-vector's had no effect
This commit is contained in:
parent
8b214862c5
commit
54877e9dec
6 changed files with 53 additions and 7 deletions
|
@ -481,10 +481,10 @@ string CPPCompile::GenAddToExpr(const Expr* e, GenType gt, bool top_level) {
|
|||
if ( t->Tag() == TYPE_VECTOR ) {
|
||||
auto& rt = rhs->GetType();
|
||||
|
||||
if ( IsVector(rt->Tag()) && same_type(lhs->GetType(), rt) )
|
||||
add_to_func = "vector_vec_append__CPP";
|
||||
else
|
||||
if ( e->AsAddToExpr()->IsVectorElemAppend() )
|
||||
add_to_func = "vector_append__CPP";
|
||||
else
|
||||
add_to_func = "vector_vec_append__CPP";
|
||||
}
|
||||
|
||||
else if ( t->Tag() == TYPE_PATTERN )
|
||||
|
|
|
@ -764,7 +764,7 @@ ExprPtr AddToExpr::Reduce(Reducer* c, StmtPtr& red_stmt) {
|
|||
|
||||
red_stmt = MergeStmts(red_stmt1, red_stmt2);
|
||||
|
||||
if ( tag == TYPE_VECTOR && (! IsVector(op2->GetType()->Tag()) || ! same_type(t, op2->GetType())) ) {
|
||||
if ( is_vector_elem_append ) {
|
||||
auto append = with_location_of(make_intrusive<AppendToExpr>(op1->Duplicate(), op2), this);
|
||||
auto append_stmt = with_location_of(make_intrusive<ExprStmt>(append), this);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue