mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Confluent ModuleSource
usage
This commit is contained in:
parent
38853459e3
commit
5c5f90ba57
2 changed files with 6 additions and 18 deletions
|
@ -26,11 +26,7 @@ impl Module {
|
|||
/// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
|
||||
pub fn definition_source(self, db: &impl DefDatabase) -> InFile<ModuleSource> {
|
||||
let def_map = db.crate_def_map(self.id.krate);
|
||||
let src = def_map[self.id.local_id].definition_source(db);
|
||||
src.map(|it| match it {
|
||||
Either::Left(it) => ModuleSource::SourceFile(it),
|
||||
Either::Right(it) => ModuleSource::Module(it),
|
||||
})
|
||||
def_map[self.id.local_id].definition_source(db)
|
||||
}
|
||||
|
||||
/// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue