aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/descriptors/function/mod.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-18 13:21:23 +0000
committerAleksey Kladov <[email protected]>2018-11-18 13:21:23 +0000
commit4e48917c00d24e1e1785e1959a2f3495a902410b (patch)
tree0ae3a1f3c92ce9e308934e023d6a24385b4260d6 /crates/ra_analysis/src/descriptors/function/mod.rs
parentcb22a799d60c6c5f81ad0f3d0361f575264f3bc2 (diff)
use loc2id for FnIds
Diffstat (limited to 'crates/ra_analysis/src/descriptors/function/mod.rs')
-rw-r--r--crates/ra_analysis/src/descriptors/function/mod.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/descriptors/function/mod.rs b/crates/ra_analysis/src/descriptors/function/mod.rs
index d5db28a64..86eee5e93 100644
--- a/crates/ra_analysis/src/descriptors/function/mod.rs
+++ b/crates/ra_analysis/src/descriptors/function/mod.rs
@@ -8,17 +8,18 @@ use ra_syntax::{
8 TextRange, TextUnit, 8 TextRange, TextUnit,
9}; 9};
10 10
11use crate::{syntax_ptr::SyntaxPtr, FileId}; 11use crate::{
12 syntax_ptr::SyntaxPtr, FileId,
13 loc2id::IdDatabase,
14};
12 15
13pub(crate) use self::scope::{resolve_local_name, FnScopes}; 16pub(crate) use self::scope::{resolve_local_name, FnScopes};
14 17pub(crate) use crate::loc2id::FnId;
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
16pub(crate) struct FnId(SyntaxPtr);
17 18
18impl FnId { 19impl FnId {
19 pub(crate) fn new(file_id: FileId, fn_def: ast::FnDef) -> FnId { 20 pub(crate) fn get(db: &impl IdDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId {
20 let ptr = SyntaxPtr::new(file_id, fn_def.syntax()); 21 let ptr = SyntaxPtr::new(file_id, fn_def.syntax());
21 FnId(ptr) 22 db.id_maps().fn_id(ptr)
22 } 23 }
23} 24}
24 25