Parse module params loc and rename to pattern

This commit is contained in:
Agus Zubiaga 2024-06-27 16:14:56 -03:00
parent c6e42ecf0c
commit 7ac72159e9
No known key found for this signature in database
10 changed files with 20 additions and 14 deletions

View file

@ -182,11 +182,17 @@ pub fn fmt_module_header<'a>(buf: &mut Buf, header: &'a ModuleHeader<'a>) {
let mut indent = fmt_spaces_with_outdent(buf, header.after_keyword, 0);
if let Some(params) = &header.params {
if is_collection_multiline(&params.params) {
if is_collection_multiline(&params.pattern.value) {
indent = INDENT;
}
fmt_collection(buf, indent, Braces::Curly, params.params, Newlines::Yes);
fmt_collection(
buf,
indent,
Braces::Curly,
params.pattern.value,
Newlines::Yes,
);
indent = fmt_spaces_with_outdent(buf, params.before_arrow, indent);
buf.push_str("->");

View file

@ -342,7 +342,7 @@ impl<'a> RemoveSpaces<'a> for Module<'a> {
impl<'a> RemoveSpaces<'a> for ModuleParams<'a> {
fn remove_spaces(&self, arena: &'a Bump) -> Self {
ModuleParams {
params: self.params.remove_spaces(arena),
pattern: self.pattern.remove_spaces(arena),
before_arrow: &[],
after_arrow: &[],
}