Simplify hir_def TestDB
This commit is contained in:
parent
5368e2c103
commit
2b5ea5c730
@ -15,7 +15,7 @@
|
||||
use syntax::{algo, ast, AstNode, TextRange, TextSize};
|
||||
use test_utils::extract_annotations;
|
||||
|
||||
use crate::{db::DefDatabase, nameres::DefMap, Lookup, ModuleDefId, ModuleId};
|
||||
use crate::{db::DefDatabase, nameres::DefMap, src::HasSource, Lookup, ModuleDefId, ModuleId};
|
||||
|
||||
#[salsa::database(
|
||||
base_db::SourceDatabaseExtStorage,
|
||||
@ -115,14 +115,9 @@ fn block_at_position(&self, def_map: &DefMap, position: FilePosition) -> Option<
|
||||
if file_id != position.file_id.into() {
|
||||
continue;
|
||||
}
|
||||
let root = self.parse_or_expand(file_id).unwrap();
|
||||
let ast_map = self.ast_id_map(file_id);
|
||||
let item_tree = self.item_tree(file_id);
|
||||
for decl in module.scope.declarations() {
|
||||
if let ModuleDefId::FunctionId(it) = decl {
|
||||
let ast =
|
||||
ast_map.get(item_tree[it.lookup(self).id.value].ast_id).to_node(&root);
|
||||
let range = ast.syntax().text_range();
|
||||
let range = it.lookup(self).source(self).value.syntax().text_range();
|
||||
|
||||
if !range.contains(position.offset) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user