aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/hir')
-rw-r--r--crates/ra_analysis/src/hir/function/mod.rs10
-rw-r--r--crates/ra_analysis/src/hir/query_definitions.rs4
2 files changed, 8 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/hir/function/mod.rs b/crates/ra_analysis/src/hir/function/mod.rs
index 9ca8f4e7c..280218fd4 100644
--- a/crates/ra_analysis/src/hir/function/mod.rs
+++ b/crates/ra_analysis/src/hir/function/mod.rs
@@ -11,8 +11,8 @@ use ra_syntax::{
11}; 11};
12 12
13use crate::{ 13use crate::{
14 hir::HirDatabase, 14 hir::{HirDatabase, SourceItemId},
15 syntax_ptr::SyntaxPtr, FileId, 15 FileId,
16}; 16};
17 17
18pub(crate) use self::scope::FnScopes; 18pub(crate) use self::scope::FnScopes;
@@ -20,8 +20,10 @@ pub(crate) use crate::loc2id::FnId;
20 20
21impl FnId { 21impl FnId {
22 pub(crate) fn get(db: &impl HirDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId { 22 pub(crate) fn get(db: &impl HirDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId {
23 let ptr = SyntaxPtr::new(file_id, fn_def.syntax()); 23 let file_items = db.file_items(file_id);
24 db.id_maps().fn_id(ptr) 24 let item_id = file_items.id_of(fn_def.syntax());
25 let item_id = SourceItemId { file_id, item_id };
26 db.id_maps().fn_id(item_id)
25 } 27 }
26} 28}
27 29
diff --git a/crates/ra_analysis/src/hir/query_definitions.rs b/crates/ra_analysis/src/hir/query_definitions.rs
index cdd986ce4..6c633e9ab 100644
--- a/crates/ra_analysis/src/hir/query_definitions.rs
+++ b/crates/ra_analysis/src/hir/query_definitions.rs
@@ -26,8 +26,8 @@ use crate::{
26 26
27/// Resolve `FnId` to the corresponding `SyntaxNode` 27/// Resolve `FnId` to the corresponding `SyntaxNode`
28pub(super) fn fn_syntax(db: &impl HirDatabase, fn_id: FnId) -> FnDefNode { 28pub(super) fn fn_syntax(db: &impl HirDatabase, fn_id: FnId) -> FnDefNode {
29 let ptr = db.id_maps().fn_ptr(fn_id); 29 let item_id = db.id_maps().fn_item_id(fn_id);
30 let syntax = db.resolve_syntax_ptr(ptr); 30 let syntax = db.file_item(item_id);
31 FnDef::cast(syntax.borrowed()).unwrap().owned() 31 FnDef::cast(syntax.borrowed()).unwrap().owned()
32} 32}
33 33