mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Fixing a bug with nested record ctors.
If a record field was initialized with another record ctor, there was no record type coercion in place in case of a type mismatch.
This commit is contained in:
parent
af3267acc3
commit
7526058071
1 changed files with 10 additions and 2 deletions
12
src/Expr.cc
12
src/Expr.cc
|
@ -3316,8 +3316,16 @@ Val* RecordConstructorExpr::InitVal(const BroType* t, Val* aggr) const
|
|||
break;
|
||||
}
|
||||
|
||||
else
|
||||
ar->Assign(t_i, rv->Lookup(i)->Ref());
|
||||
if ( ar_t->FieldType(t_i)->Tag() == TYPE_RECORD
|
||||
&& ! same_type(ar_t->FieldType(t_i), rv->Lookup(i)->Type()) )
|
||||
{
|
||||
Expr* rhs = new ConstExpr(rv->Lookup(i)->Ref());
|
||||
Expr* e = new RecordCoerceExpr(rhs, ar_t->FieldType(t_i)->AsRecordType());
|
||||
ar->Assign(t_i, e->Eval(0));
|
||||
break;
|
||||
}
|
||||
|
||||
ar->Assign(t_i, rv->Lookup(i)->Ref());
|
||||
}
|
||||
|
||||
for ( i = 0; i < ar_t->NumFields(); ++i )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue