From 5af9e475f4acce54f8383ed22febc412cf2541d0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 1 Jun 2019 21:17:57 +0300 Subject: add AstDatabase --- crates/ra_hir/src/source_id.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir/src/source_id.rs') diff --git a/crates/ra_hir/src/source_id.rs b/crates/ra_hir/src/source_id.rs index 13f548eaf..986269e00 100644 --- a/crates/ra_hir/src/source_id.rs +++ b/crates/ra_hir/src/source_id.rs @@ -3,7 +3,7 @@ use std::{marker::PhantomData, sync::Arc, hash::{Hash, Hasher}}; use ra_arena::{Arena, RawId, impl_arena_id}; use ra_syntax::{SyntaxNodePtr, TreeArc, SyntaxNode, AstNode, ast}; -use crate::{HirFileId, DefDatabase}; +use crate::{HirFileId, AstDatabase}; /// `AstId` points to an AST node in any file. /// @@ -38,7 +38,7 @@ impl AstId { self.file_id } - pub(crate) fn to_node(&self, db: &impl DefDatabase) -> TreeArc { + pub(crate) fn to_node(&self, db: &impl AstDatabase) -> TreeArc { let syntax_node = db.ast_id_to_node(self.file_id, self.file_ast_id.raw); N::cast(&syntax_node).unwrap().to_owned() } @@ -87,7 +87,7 @@ pub struct AstIdMap { } impl AstIdMap { - pub(crate) fn ast_id_map_query(db: &impl DefDatabase, file_id: HirFileId) -> Arc { + pub(crate) fn ast_id_map_query(db: &impl AstDatabase, file_id: HirFileId) -> Arc { let map = if let Some(node) = db.parse_or_expand(file_id) { AstIdMap::from_source(&*node) } else { @@ -97,7 +97,7 @@ impl AstIdMap { } pub(crate) fn file_item_query( - db: &impl DefDatabase, + db: &impl AstDatabase, file_id: HirFileId, ast_id: ErasedFileAstId, ) -> TreeArc { -- cgit v1.2.3