mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
if ( ar_t->FieldType(t_i)->Tag() == TYPE_RECORD
|
||||||
ar->Assign(t_i, rv->Lookup(i)->Ref());
|
&& ! 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 )
|
for ( i = 0; i < ar_t->NumFields(); ++i )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue