From b7049ea543d5ea9a965dfa51d9da923739f2420d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 27 Nov 2018 23:33:36 +0300 Subject: move query definitions --- crates/ra_analysis/src/hir/function/imp.rs | 21 --------------------- crates/ra_analysis/src/hir/function/mod.rs | 4 +--- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 crates/ra_analysis/src/hir/function/imp.rs (limited to 'crates/ra_analysis/src/hir/function') 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 @@ -use std::sync::Arc; - -use ra_syntax::ast::{AstNode, FnDef, FnDefNode}; - -use crate::hir::{ - function::{FnId, FnScopes}, - HirDatabase, -}; - -/// Resolve `FnId` to the corresponding `SyntaxNode` -pub(crate) fn fn_syntax(db: &impl HirDatabase, fn_id: FnId) -> FnDefNode { - let ptr = db.id_maps().fn_ptr(fn_id); - let syntax = db.resolve_syntax_ptr(ptr); - FnDef::cast(syntax.borrowed()).unwrap().owned() -} - -pub(crate) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc { - let syntax = db.fn_syntax(fn_id); - let res = FnScopes::new(syntax.borrowed()); - Arc::new(res) -} 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 @@ -pub(super) mod imp; mod scope; use std::{ @@ -14,14 +13,13 @@ use ra_syntax::{ use crate::{ hir::HirDatabase, syntax_ptr::SyntaxPtr, FileId, - loc2id::IdDatabase, }; pub(crate) use self::scope::{resolve_local_name, FnScopes}; pub(crate) use crate::loc2id::FnId; impl FnId { - pub(crate) fn get(db: &impl IdDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId { + pub(crate) fn get(db: &impl HirDatabase, file_id: FileId, fn_def: ast::FnDef) -> FnId { let ptr = SyntaxPtr::new(file_id, fn_def.syntax()); db.id_maps().fn_id(ptr) } -- cgit v1.2.3