mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Make ItemTreeId
its own type
This commit is contained in:
parent
5632e61f79
commit
759f8c83e5
8 changed files with 77 additions and 37 deletions
|
@ -14,12 +14,12 @@ impl<N: ItemTreeNode> HasSource for AssocItemLoc<N> {
|
|||
type Value = N::Source;
|
||||
|
||||
fn source(&self, db: &dyn DefDatabase) -> InFile<N::Source> {
|
||||
let tree = db.item_tree(self.id.file_id);
|
||||
let ast_id_map = db.ast_id_map(self.id.file_id);
|
||||
let root = db.parse_or_expand(self.id.file_id).unwrap();
|
||||
let tree = self.id.item_tree(db);
|
||||
let ast_id_map = db.ast_id_map(self.id.file_id());
|
||||
let root = db.parse_or_expand(self.id.file_id()).unwrap();
|
||||
let node = &tree[self.id.value];
|
||||
|
||||
InFile::new(self.id.file_id, ast_id_map.get(node.ast_id()).to_node(&root))
|
||||
InFile::new(self.id.file_id(), ast_id_map.get(node.ast_id()).to_node(&root))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,12 @@ impl<N: ItemTreeNode> HasSource for ItemLoc<N> {
|
|||
type Value = N::Source;
|
||||
|
||||
fn source(&self, db: &dyn DefDatabase) -> InFile<N::Source> {
|
||||
let tree = db.item_tree(self.id.file_id);
|
||||
let ast_id_map = db.ast_id_map(self.id.file_id);
|
||||
let root = db.parse_or_expand(self.id.file_id).unwrap();
|
||||
let tree = self.id.item_tree(db);
|
||||
let ast_id_map = db.ast_id_map(self.id.file_id());
|
||||
let root = db.parse_or_expand(self.id.file_id()).unwrap();
|
||||
let node = &tree[self.id.value];
|
||||
|
||||
InFile::new(self.id.file_id, ast_id_map.get(node.ast_id()).to_node(&root))
|
||||
InFile::new(self.id.file_id(), ast_id_map.get(node.ast_id()).to_node(&root))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue