mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
add typed ids
This commit is contained in:
parent
619a4c05ba
commit
fb8b354dcc
7 changed files with 88 additions and 45 deletions
|
@ -13,10 +13,10 @@ use ra_syntax::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
HirDatabase, Function, Struct, Enum, SourceItemId,
|
||||
HirDatabase, Function, Struct, Enum,
|
||||
AsName, Module, HirFileId, Crate, Trait, Resolver,
|
||||
ids::LocationCtx,
|
||||
expr
|
||||
expr, AstId
|
||||
};
|
||||
|
||||
/// Locates the module by `FileId`. Picks topmost module in the file.
|
||||
|
@ -55,7 +55,7 @@ fn module_from_inline(
|
|||
assert!(!module.has_semi());
|
||||
let file_id = file_id.into();
|
||||
let file_items = db.file_items(file_id);
|
||||
let item_id = file_items.id_of(file_id, module.syntax()).with_file_id(file_id);
|
||||
let item_id = file_items.ast_id(module).with_file_id(file_id);
|
||||
module_from_source(db, file_id, Some(item_id))
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ pub fn module_from_child_node(
|
|||
fn module_from_source(
|
||||
db: &impl HirDatabase,
|
||||
file_id: HirFileId,
|
||||
decl_id: Option<SourceItemId>,
|
||||
decl_id: Option<AstId<ast::Module>>,
|
||||
) -> Option<Module> {
|
||||
let source_root_id = db.file_source_root(file_id.as_original_file());
|
||||
db.source_root_crates(source_root_id).iter().map(|&crate_id| Crate { crate_id }).find_map(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue