mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Render parentheses at the right position in docs
This commit is contained in:
parent
33ed87cacb
commit
1be74346f4
1 changed files with 6 additions and 4 deletions
|
@ -540,9 +540,7 @@ fn type_annotation_to_html(
|
|||
type_annotation_to_html(indent_level, buf, extension, true);
|
||||
}
|
||||
TypeAnnotation::Function { args, output } => {
|
||||
if needs_parens {
|
||||
buf.push('(');
|
||||
}
|
||||
let mut paren_is_open = false;
|
||||
let mut peekable_args = args.iter().peekable();
|
||||
while let Some(arg) = peekable_args.next() {
|
||||
if is_multiline {
|
||||
|
@ -551,6 +549,10 @@ fn type_annotation_to_html(
|
|||
}
|
||||
indent(buf, indent_level + 1);
|
||||
}
|
||||
if needs_parens && !paren_is_open {
|
||||
buf.push('(');
|
||||
paren_is_open = true;
|
||||
}
|
||||
|
||||
let child_needs_parens = match arg {
|
||||
TypeAnnotation::Function { args: _, output: _ } => true,
|
||||
|
@ -577,7 +579,7 @@ fn type_annotation_to_html(
|
|||
}
|
||||
|
||||
type_annotation_to_html(next_indent_level, buf, output, false);
|
||||
if needs_parens {
|
||||
if needs_parens && paren_is_open {
|
||||
buf.push(')');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue