disambiguate descriptions of enums; include attributes when describing records

This commit is contained in:
Vern Paxson 2021-03-18 10:53:36 -07:00
parent d5e6d8e249
commit ef3eaed3fb
11 changed files with 48 additions and 20 deletions

View file

@ -1064,6 +1064,12 @@ void RecordType::DescribeFields(ODesc* d) const
else
td->type->Describe(d);
if ( td->attrs )
{
d->SP();
td->attrs->Describe(d);
}
d->Add(";");
}
}
@ -1419,6 +1425,27 @@ const EnumValPtr& EnumType::GetEnumVal(bro_int_t i)
return it->second;
}
void EnumType::Describe(ODesc* d) const
{
auto t = Tag();
if ( d->IsBinary() )
{
d->Add(int(t));
if ( ! d->IsShort() )
d->Add(GetName());
}
else
{
d->Add(type_name(t));
if ( ! d->IsShort() )
{
d->SP();
d->Add(GetName());
}
}
}
void EnumType::DescribeReST(ODesc* d, bool roles_only) const
{
d->Add(":zeek:type:`enum`");