Make ModuleId's krate field private
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user