mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Basic formatting of multi-abilities
This commit is contained in:
parent
0642952d05
commit
1053c11907
2 changed files with 44 additions and 4 deletions
|
@ -546,8 +546,8 @@ impl<'a> Formattable for Tag<'a> {
|
|||
|
||||
impl<'a> Formattable for HasClause<'a> {
|
||||
fn is_multiline(&self) -> bool {
|
||||
// TODO(abilities)
|
||||
self.abilities[0].is_multiline()
|
||||
// No, always put abilities in a "has" clause on one line
|
||||
false
|
||||
}
|
||||
|
||||
fn format_with_options<'buf>(
|
||||
|
@ -561,8 +561,15 @@ impl<'a> Formattable for HasClause<'a> {
|
|||
buf.spaces(1);
|
||||
buf.push_str("has");
|
||||
buf.spaces(1);
|
||||
// TODO(abilities)
|
||||
self.abilities[0].format_with_options(buf, parens, newlines, indent);
|
||||
|
||||
for (i, ab) in self.abilities.iter().enumerate() {
|
||||
if i > 0 {
|
||||
buf.spaces(1);
|
||||
buf.push('&');
|
||||
buf.spaces(1);
|
||||
}
|
||||
ab.format_with_options(buf, parens, newlines, indent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue