Some more fragment fixes

This commit is contained in:
Lukas Wirth 2021-07-20 17:03:39 +02:00
parent e8f1abf5f7
commit cb7b4a5d5b
5 changed files with 115 additions and 148 deletions

View file

@ -303,6 +303,13 @@ impl ModuleDef {
Some(segments.into_iter().join("::"))
}
pub fn canonical_module_path(
&self,
db: &dyn HirDatabase,
) -> Option<impl Iterator<Item = Module>> {
self.module(db).map(|it| it.path_to_root(db).into_iter().rev())
}
pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
match self {
ModuleDef::Adt(it) => Some(it.name(db)),