Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/nameres.rs')
| -rw-r--r-- | crates/hir-def/src/nameres.rs | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/crates/hir-def/src/nameres.rs b/crates/hir-def/src/nameres.rs index c908e45754..e62fd3dab7 100644 --- a/crates/hir-def/src/nameres.rs +++ b/crates/hir-def/src/nameres.rs @@ -80,7 +80,7 @@ use crate::{ LocalModuleId, Lookup, MacroExpander, MacroId, ModuleId, ProcMacroId, UseId, db::DefDatabase, item_scope::{BuiltinShadowMode, ItemScope}, - item_tree::{ItemTreeId, Mod, TreeId}, + item_tree::{FileItemTreeId, Mod, TreeId}, nameres::{diagnostics::DefDiagnostic, path_resolution::ResolveMode}, per_ns::PerNs, visibility::{Visibility, VisibilityExplicitness}, @@ -289,11 +289,13 @@ pub enum ModuleOrigin { File { is_mod_rs: bool, declaration: FileAstId<ast::Module>, - declaration_tree_id: ItemTreeId<Mod>, + declaration_tree_id: TreeId, + file_item_tree_id: FileItemTreeId<Mod>, definition: EditionedFileId, }, Inline { - definition_tree_id: ItemTreeId<Mod>, + definition_tree_id: TreeId, + file_item_tree_id: FileItemTreeId<Mod>, definition: FileAstId<ast::Module>, }, /// Pseudo-module introduced by a block scope (contains only inner items). @@ -309,7 +311,7 @@ impl ModuleOrigin { &ModuleOrigin::File { declaration, declaration_tree_id, .. } => { Some(AstId::new(declaration_tree_id.file_id(), declaration)) } - &ModuleOrigin::Inline { definition, definition_tree_id } => { + &ModuleOrigin::Inline { definition, definition_tree_id, file_item_tree_id: _ } => { Some(AstId::new(definition_tree_id.file_id(), definition)) } ModuleOrigin::CrateRoot { .. } | ModuleOrigin::BlockExpr { .. } => None, @@ -341,12 +343,14 @@ impl ModuleOrigin { let sf = db.parse(editioned_file_id).tree(); InFile::new(editioned_file_id.into(), ModuleSource::SourceFile(sf)) } - &ModuleOrigin::Inline { definition, definition_tree_id } => InFile::new( - definition_tree_id.file_id(), - ModuleSource::Module( - AstId::new(definition_tree_id.file_id(), definition).to_node(db), - ), - ), + &ModuleOrigin::Inline { definition, definition_tree_id, file_item_tree_id: _ } => { + InFile::new( + definition_tree_id.file_id(), + ModuleSource::Module( + AstId::new(definition_tree_id.file_id(), definition).to_node(db), + ), + ) + } ModuleOrigin::BlockExpr { block, .. } => { InFile::new(block.file_id, ModuleSource::BlockExpr(block.to_node(db))) } @@ -773,10 +777,12 @@ impl ModuleData { ErasedAstId::new(definition.into(), ROOT_ERASED_FILE_AST_ID).to_range(db), ) } - &ModuleOrigin::Inline { definition, definition_tree_id } => InFile::new( - definition_tree_id.file_id(), - AstId::new(definition_tree_id.file_id(), definition).to_range(db), - ), + &ModuleOrigin::Inline { definition, definition_tree_id, file_item_tree_id: _ } => { + InFile::new( + definition_tree_id.file_id(), + AstId::new(definition_tree_id.file_id(), definition).to_range(db), + ) + } ModuleOrigin::BlockExpr { block, .. } => InFile::new(block.file_id, block.to_range(db)), } } |