mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
disambiguate descriptions of enums; include attributes when describing records
This commit is contained in:
parent
d5e6d8e249
commit
ef3eaed3fb
11 changed files with 48 additions and 20 deletions
27
src/Type.cc
27
src/Type.cc
|
@ -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`");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue