Parse and format aliases in import defs

This commit is contained in:
Agus Zubiaga 2023-11-29 10:54:25 -03:00
parent 933fde77a0
commit 76d799ea13
No known key found for this signature in database
12 changed files with 85 additions and 6 deletions

View file

@ -459,6 +459,7 @@ pub enum ValueDef<'a> {
/// e.g. `import [Req] as Http from InternalHttp`.
ModuleImport {
name: Loc<crate::header::ModuleName<'a>>,
alias: Option<Loc<crate::header::ModuleName<'a>>>,
},
}
@ -1797,7 +1798,9 @@ impl<'a> Malformed for ValueDef<'a> {
condition,
preceding_comment: _,
} => condition.is_malformed(),
ValueDef::ModuleImport { name } => name.value.contains_dot(),
ValueDef::ModuleImport { name, alias } => {
name.value.contains_dot() || alias.map_or(false, |x| x.value.contains_dot())
}
}
}
}