mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
Merge branch 'topic/robin/record-coercion' into topic/robin/logging-internals
* topic/robin/record-coercion: Fixing a bug with nested record ctors. Enabling automatic coercion from record type A to be B as long as A has all the types that B has. Conflicts: src/Expr.cc
This commit is contained in:
commit
05f2104fec
2 changed files with 24 additions and 12 deletions
12
src/Val.cc
12
src/Val.cc
|
@ -2949,8 +2949,16 @@ RecordVal* RecordVal::CoerceTo(const RecordType* t, Val* aggr) const
|
|||
break;
|
||||
}
|
||||
|
||||
else
|
||||
ar->Assign(t_i, Lookup(i)->Ref());
|
||||
if ( ar_t->FieldType(t_i)->Tag() == TYPE_RECORD
|
||||
&& ! same_type(ar_t->FieldType(t_i), Lookup(i)->Type()) )
|
||||
{
|
||||
Expr* rhs = new ConstExpr(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, Lookup(i)->Ref());
|
||||
}
|
||||
|
||||
for ( i = 0; i < ar_t->NumFields(); ++i )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue