fix for cloning records with fields of type "any"

This commit is contained in:
Vern Paxson 2021-06-01 08:52:24 -07:00
parent cd8e16e090
commit 099dc99d2b
2 changed files with 8 additions and 5 deletions

View file

@ -1176,13 +1176,15 @@ public:
/**
* Appends a value to the record's fields. The caller is responsible
* for ensuring that fields are appended in the correct order and
* with the correct type.
* with the correct type. The type needs to be passed in because
* it's unsafe to take it from v when the field's type is "any" while
* v is a concrete type.
* @param v The value to append.
*/
void AppendField(ValPtr v)
void AppendField(ValPtr v, const TypePtr& t)
{
if ( v )
record_val->emplace_back(ZVal(v, v->GetType()));
record_val->emplace_back(ZVal(v, t));
else
record_val->emplace_back(std::nullopt);
}