Format impls blocks

This commit is contained in:
Ayaz Hafiz 2022-07-15 11:14:49 -04:00
parent 85599e3a9a
commit 3ada644544
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 54 additions and 6 deletions

View file

@ -4,7 +4,7 @@ use roc_module::called_via::{BinOp, UnaryOp};
use roc_parse::{
ast::{
AbilityMember, AssignedField, Collection, CommentOrNewline, Defs, Expr, Has, HasAbilities,
HasAbility, HasClause, Module, Pattern, Spaced, StrLiteral, StrSegment, Tag,
HasAbility, HasClause, HasImpls, Module, Pattern, Spaced, StrLiteral, StrSegment, Tag,
TypeAnnotation, TypeDef, TypeHeader, ValueDef, WhenBranch,
},
header::{
@ -801,6 +801,17 @@ impl<'a> RemoveSpaces<'a> for Tag<'a> {
}
}
impl<'a> RemoveSpaces<'a> for HasImpls<'a> {
fn remove_spaces(&self, arena: &'a Bump) -> Self {
match *self {
HasImpls::HasImpls(impls) => HasImpls::HasImpls(impls.remove_spaces(arena)),
HasImpls::SpaceBefore(has, _) | HasImpls::SpaceAfter(has, _) => {
has.remove_spaces(arena)
}
}
}
}
impl<'a> RemoveSpaces<'a> for HasAbility<'a> {
fn remove_spaces(&self, arena: &'a Bump) -> Self {
match *self {