Deprecate RecordVal::Lookup(const char*, bool)

Replace with GetField(const char*) and GetFieldOrDefault(const char*).
This commit is contained in:
Jon Siwek 2020-05-19 21:09:40 -07:00
parent 2b4d80c849
commit 5bf2ed02d7
14 changed files with 128 additions and 80 deletions

View file

@ -2781,14 +2781,24 @@ void RecordVal::DoneParsing()
parse_time_records.clear();
}
IntrusivePtr<Val> RecordVal::Lookup(const char* field, bool with_default) const
const IntrusivePtr<Val>& RecordVal::GetField(const char* field) const
{
int idx = GetType()->AsRecordType()->FieldOffset(field);
if ( idx < 0 )
reporter->InternalError("missing record field: %s", field);
return with_default ? GetFieldOrDefault(idx) : GetField(idx);
return GetField(idx);
}
IntrusivePtr<Val> RecordVal::GetFieldOrDefault(const char* field) const
{
int idx = GetType()->AsRecordType()->FieldOffset(field);
if ( idx < 0 )
reporter->InternalError("missing record field: %s", field);
return GetFieldOrDefault(idx);
}
IntrusivePtr<RecordVal> RecordVal::CoerceTo(IntrusivePtr<RecordType> t,