Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/has_source.rs')
-rw-r--r--crates/hir/src/has_source.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 6f427d728b..1aa7994001 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -20,7 +20,7 @@ use crate::{
pub trait HasSource {
type Ast;
/// Fetches the definition's source node.
- /// Using [`crate::Semantics::source`] is preferred when working with [`crate::Semantics`],
+ /// Using [`crate::SemanticsImpl::source`] is preferred when working with [`crate::Semantics`],
/// as that caches the parsed file in the semantics' cache.
///
/// The current some implementations can return `InFile` instead of `Option<InFile>`.
@@ -35,23 +35,23 @@ 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: &dyn HirDatabase) -> InFile<ModuleSource> {
let def_map = self.id.def_map(db);
- def_map[self.id.local_id].definition_source(db)
+ def_map[self.id].definition_source(db)
}
/// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
pub fn definition_source_range(self, db: &dyn HirDatabase) -> InFile<TextRange> {
let def_map = self.id.def_map(db);
- def_map[self.id.local_id].definition_source_range(db)
+ def_map[self.id].definition_source_range(db)
}
pub fn definition_source_file_id(self, db: &dyn HirDatabase) -> HirFileId {
let def_map = self.id.def_map(db);
- def_map[self.id.local_id].definition_source_file_id()
+ def_map[self.id].definition_source_file_id()
}
pub fn is_mod_rs(self, db: &dyn HirDatabase) -> bool {
let def_map = self.id.def_map(db);
- match def_map[self.id.local_id].origin {
+ match def_map[self.id].origin {
ModuleOrigin::File { is_mod_rs, .. } => is_mod_rs,
_ => false,
}
@@ -59,7 +59,7 @@ impl Module {
pub fn as_source_file_id(self, db: &dyn HirDatabase) -> Option<EditionedFileId> {
let def_map = self.id.def_map(db);
- match def_map[self.id.local_id].origin {
+ match def_map[self.id].origin {
ModuleOrigin::File { definition, .. } | ModuleOrigin::CrateRoot { definition, .. } => {
Some(definition)
}
@@ -69,21 +69,21 @@ impl Module {
pub fn is_inline(self, db: &dyn HirDatabase) -> bool {
let def_map = self.id.def_map(db);
- def_map[self.id.local_id].origin.is_inline()
+ def_map[self.id].origin.is_inline()
}
/// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
/// `None` for the crate root.
pub fn declaration_source(self, db: &dyn HirDatabase) -> Option<InFile<ast::Module>> {
let def_map = self.id.def_map(db);
- def_map[self.id.local_id].declaration_source(db)
+ def_map[self.id].declaration_source(db)
}
/// Returns a text range which declares this module, either a `mod foo;` or a `mod foo {}`.
/// `None` for the crate root.
pub fn declaration_source_range(self, db: &dyn HirDatabase) -> Option<InFile<TextRange>> {
let def_map = self.id.def_map(db);
- def_map[self.id.local_id].declaration_source_range(db)
+ def_map[self.id].declaration_source_range(db)
}
}