mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Var/Func: Render function parameters using comma, not semicolon
A bit larger follow-up to what Tim pointed out: Function prototype descriptions previously used semicolons to separate parameters. Switch to use commas when a RecordType is used as function parameter. Use existing "func_args" naming for consistency.
This commit is contained in:
parent
8ede22f6ec
commit
8109bbc52f
22 changed files with 50 additions and 32 deletions
14
src/Type.cc
14
src/Type.cc
|
@ -835,7 +835,7 @@ void FuncType::DoDescribe(ODesc* d) const
|
|||
{
|
||||
d->Add(FlavorString());
|
||||
d->Add("(");
|
||||
args->DescribeFields(d);
|
||||
args->DescribeFields(d, true);
|
||||
d->Add(")");
|
||||
|
||||
if ( yield )
|
||||
|
@ -849,7 +849,7 @@ void FuncType::DoDescribe(ODesc* d) const
|
|||
d->Add(int(Tag()));
|
||||
d->Add(flavor);
|
||||
d->Add(yield != nullptr);
|
||||
args->DescribeFields(d);
|
||||
args->DescribeFields(d, true);
|
||||
if ( yield )
|
||||
yield->Describe(d);
|
||||
}
|
||||
|
@ -1477,7 +1477,7 @@ void RecordType::AddFieldsDirectly(const type_decl_list& others, bool add_log_at
|
|||
num_fields = types->length();
|
||||
}
|
||||
|
||||
void RecordType::DescribeFields(ODesc* d) const
|
||||
void RecordType::DescribeFields(ODesc* d, bool func_args) const
|
||||
{
|
||||
if ( d->IsReadable() )
|
||||
{
|
||||
|
@ -1501,7 +1501,13 @@ void RecordType::DescribeFields(ODesc* d) const
|
|||
td->attrs->Describe(d);
|
||||
}
|
||||
|
||||
d->Add(";");
|
||||
if ( func_args )
|
||||
{
|
||||
if ( i + 1 < num_fields )
|
||||
d->Add(",");
|
||||
}
|
||||
else
|
||||
d->Add(";");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue