diff options
Diffstat (limited to 'crates/ra_analysis/src/hir/function')
-rw-r--r-- | crates/ra_analysis/src/hir/function/imp.rs | 21 | ||||
-rw-r--r-- | crates/ra_analysis/src/hir/function/mod.rs | 4 |
2 files changed, 1 insertions, 24 deletions
diff --git a/crates/ra_analysis/src/hir/function/imp.rs b/crates/ra_analysis/src/hir/function/imp.rs deleted file mode 100644 index 5f5f68ac5..000000000 --- a/crates/ra_analysis/src/hir/function/imp.rs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | use std::sync::Arc; | ||
2 | |||
3 | use ra_syntax::ast::{AstNode, FnDef, FnDefNode}; | ||
4 | |||
5 | use crate::hir::{ | ||
6 | function::{FnId, FnScopes}, | ||
7 | HirDatabase, | ||
8 | }; | ||
9 | |||
10 | /// Resolve `FnId` to the corresponding `SyntaxNode` | ||
11 | pub(crate) fn fn_syntax(db: &impl HirDatabase, fn_id: FnId) -> FnDefNode { | ||
12 | let ptr = db.id_maps().fn_ptr(fn_id); | ||
13 | let syntax = db.resolve_syntax_ptr(ptr); | ||
14 | FnDef::cast(syntax.borrowed()).unwrap().owned() | ||
15 | } | ||
16 | |||
17 | pub(crate) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc<FnScopes> { | ||
18 | let syntax = db.fn_syntax(fn_id); | ||
19 | let res = FnScopes::new(syntax.borrowed()); | ||
20 | Arc::new(res) | ||
21 | } | ||
diff --git a/crates/ra_analysis/src/hir/function/mod.rs b/crates/ra_analysis/src/hir/function/mod.rs index c8af6bc21..5de9806e3 100644 --- a/crates/ra_analysis/src/hir/function/mod.rs +++ b/crates/ra_analysis/src/hir/function/mod.rs | |||
@@ -1,4 +1,3 @@ | |||
1 | pub(super) mod imp; | ||
2 | mod scope; | 1 | mod scope; |
3 | 2 | ||
4 | use std::{ | 3 | use std::{ |
@@ -14,14 +13,13 @@ use ra_syntax::{ | |||
14 | use crate::{ | 13 | use crate::{ |
15 | hir::HirDatabase, | 14 | hir::HirDatabase, |
16 | syntax_ptr::SyntaxPtr, FileId, | 15 | syntax_ptr::SyntaxPtr, FileId, |
17 | loc2id::IdDatabase, | ||
18 | }; | 16 | }; |
19 | 17 | ||
20 | pub(crate) use self::scope::{resolve_local_name, FnScopes}; | 18 | pub(crate) use self::scope::{resolve_local_name, FnScopes}; |
21 | pub(crate) use crate::loc2id::FnId; | 19 | pub(crate) use crate::loc2id::FnId; |
22 | 20 | ||
23 | impl FnId { | 21 | impl FnId { |
24 | pub(crate) fn get(db: &impl IdDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId { | 22 | pub(crate) fn get(db: &impl HirDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId { |
25 | let ptr = SyntaxPtr::new(file_id, fn_def.syntax()); | 23 | let ptr = SyntaxPtr::new(file_id, fn_def.syntax()); |
26 | db.id_maps().fn_id(ptr) | 24 | db.id_maps().fn_id(ptr) |
27 | } | 25 | } |