mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Make ModuleId
's krate
field private
This commit is contained in:
parent
e73cc8b4ab
commit
3de8f57c51
10 changed files with 62 additions and 38 deletions
|
@ -36,7 +36,7 @@ impl SourceToDefCtx<'_, '_> {
|
|||
let local_id = crate_def_map.modules_for_file(file).next()?;
|
||||
Some((crate_id, local_id))
|
||||
})?;
|
||||
Some(ModuleId { krate, local_id })
|
||||
Some(ModuleId::top_level(krate, local_id))
|
||||
}
|
||||
|
||||
pub(super) fn module_to_def(&mut self, src: InFile<ast::Module>) -> Option<ModuleId> {
|
||||
|
@ -63,7 +63,8 @@ impl SourceToDefCtx<'_, '_> {
|
|||
let child_name = src.value.name()?.as_name();
|
||||
let def_map = parent_module.def_map(self.db.upcast());
|
||||
let child_id = *def_map[parent_module.local_id].children.get(&child_name)?;
|
||||
Some(ModuleId { krate: parent_module.krate, local_id: child_id })
|
||||
// FIXME: handle block expression modules
|
||||
Some(ModuleId::top_level(parent_module.krate(), child_id))
|
||||
}
|
||||
|
||||
pub(super) fn trait_to_def(&mut self, src: InFile<ast::Trait>) -> Option<TraitId> {
|
||||
|
@ -186,7 +187,7 @@ impl SourceToDefCtx<'_, '_> {
|
|||
) -> Option<MacroDefId> {
|
||||
let kind = MacroDefKind::Declarative;
|
||||
let file_id = src.file_id.original_file(self.db.upcast());
|
||||
let krate = self.file_to_def(file_id)?.krate;
|
||||
let krate = self.file_to_def(file_id)?.krate();
|
||||
let file_ast_id = self.db.ast_id_map(src.file_id).ast_id(&src.value);
|
||||
let ast_id = Some(AstId::new(src.file_id, file_ast_id.upcast()));
|
||||
Some(MacroDefId { krate, ast_id, kind, local_inner: false })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue