aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/item_tree.rs')
-rw-r--r--crates/hir_def/src/item_tree.rs13
1 files changed, 0 insertions, 13 deletions
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs
index 3233b1957..09bcb10dc 100644
--- a/crates/hir_def/src/item_tree.rs
+++ b/crates/hir_def/src/item_tree.rs
@@ -25,7 +25,6 @@ use profile::Count;
25use rustc_hash::FxHashMap; 25use rustc_hash::FxHashMap;
26use smallvec::SmallVec; 26use smallvec::SmallVec;
27use syntax::{ast, match_ast, SyntaxKind}; 27use syntax::{ast, match_ast, SyntaxKind};
28use test_utils::mark;
29 28
30use crate::{ 29use crate::{
31 attr::{Attrs, RawAttrs}, 30 attr::{Attrs, RawAttrs},
@@ -210,18 +209,6 @@ impl ItemTree {
210 } 209 }
211 } 210 }
212 211
213 pub fn source<S: ItemTreeNode>(&self, db: &dyn DefDatabase, of: ItemTreeId<S>) -> S::Source {
214 // This unwrap cannot fail, since it has either succeeded above, or resulted in an empty
215 // ItemTree (in which case there is no valid `FileItemTreeId` to call this method with).
216 let root =
217 db.parse_or_expand(of.file_id).expect("parse_or_expand failed on constructed ItemTree");
218
219 let id = self[of.value].ast_id();
220 let map = db.ast_id_map(of.file_id);
221 let ptr = map.get(id);
222 ptr.to_node(&root)
223 }
224
225 fn data(&self) -> &ItemTreeData { 212 fn data(&self) -> &ItemTreeData {
226 self.data.as_ref().expect("attempted to access data of empty ItemTree") 213 self.data.as_ref().expect("attempted to access data of empty ItemTree")
227 } 214 }