mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Fix format for the 'as' keyword
This commit is contained in:
parent
5652d4ec18
commit
0599066865
2 changed files with 46 additions and 6 deletions
|
@ -5,8 +5,8 @@ use roc_parse::{
|
|||
ast::{
|
||||
AbilityImpls, AbilityMember, AssignedField, Collection, CommentOrNewline, Defs, Expr,
|
||||
Header, Implements, ImplementsAbilities, ImplementsAbility, ImplementsClause, Module,
|
||||
Pattern, RecordBuilderField, Spaced, Spaces, StrLiteral, StrSegment, Tag, TypeAnnotation,
|
||||
TypeDef, TypeHeader, ValueDef, WhenBranch,
|
||||
Pattern, PatternAs, RecordBuilderField, Spaced, Spaces, StrLiteral, StrSegment, Tag,
|
||||
TypeAnnotation, TypeDef, TypeHeader, ValueDef, WhenBranch,
|
||||
},
|
||||
header::{
|
||||
AppHeader, ExposedName, HostedHeader, ImportsEntry, InterfaceHeader, KeywordItem,
|
||||
|
@ -800,9 +800,10 @@ impl<'a> RemoveSpaces<'a> for Pattern<'a> {
|
|||
Pattern::OptionalField(a, b) => {
|
||||
Pattern::OptionalField(a, arena.alloc(b.remove_spaces(arena)))
|
||||
}
|
||||
Pattern::As(pattern, pattern_as) => {
|
||||
Pattern::As(arena.alloc(pattern.remove_spaces(arena)), pattern_as)
|
||||
}
|
||||
Pattern::As(pattern, pattern_as) => Pattern::As(
|
||||
arena.alloc(pattern.remove_spaces(arena)),
|
||||
pattern_as.remove_spaces(arena),
|
||||
),
|
||||
Pattern::NumLiteral(a) => Pattern::NumLiteral(a),
|
||||
Pattern::NonBase10Literal {
|
||||
string,
|
||||
|
@ -826,7 +827,10 @@ impl<'a> RemoveSpaces<'a> for Pattern<'a> {
|
|||
Pattern::SingleQuote(a) => Pattern::SingleQuote(a),
|
||||
Pattern::List(pats) => Pattern::List(pats.remove_spaces(arena)),
|
||||
Pattern::Tuple(pats) => Pattern::Tuple(pats.remove_spaces(arena)),
|
||||
Pattern::ListRest(opt_pattern_as) => Pattern::ListRest(opt_pattern_as),
|
||||
Pattern::ListRest(opt_pattern_as) => Pattern::ListRest(
|
||||
opt_pattern_as
|
||||
.map(|(_, pattern_as)| ([].as_ref(), pattern_as.remove_spaces(arena))),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -936,3 +940,12 @@ impl<'a> RemoveSpaces<'a> for ImplementsAbilities<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> RemoveSpaces<'a> for PatternAs<'a> {
|
||||
fn remove_spaces(&self, arena: &'a Bump) -> Self {
|
||||
PatternAs {
|
||||
spaces_before: &[],
|
||||
identifier: self.identifier.remove_spaces(arena),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue